AXIOM Alpha Software
1 Reading and Writing Sensor Register
Execute the script that contains the sensor interface functions before we can use them:
. ./cmv.func
Set Sensor register 82 to the decimal value "3122"
cmv_reg 82 3122
Read Register 82:
cmv_reg 82
will output:
0x00000C31
1.1 statically linked busybox
http://vserver.13thfloor.at/Stuff/AXIOM/FAKE/
builtin fake devmem
all you need to get it to work is the following:
dd if=/dev/zero of=/tmp/mem bs=1k seek=4M count=1
this will create a sparse 4GB file /tmp/mem, which will be used by the fake devmem values written can be read back, non existing values return 0
/bin/sh and /sbin/devmem both link to busybox on the axiom alpha filesystem so both can be tested with this executeable
2 Capturing an Image
Preparations:
ssh root@*alpha-IP* "./cmv_train2
Capture the image:
ssh root@*alpha-IP* "./cmv_snap2 -e 10ms" | tee snap.raw16 | display -size 4096x3072 -depth 16 gray:-
So we dont need to type the password every time we snap an image:
Install:
sudo apt-get install sshpass
Use:
sshpass -p '1234' ssh root@*alpha-IP* "./cmv_snap2 -e 10ms" | tee snap.raw16 | display -size 4096x3072 -depth 16 gray:-
3 cmv_snap2
./cmv_snap2 -h This is ./cmv_snap2 V1.5 options are: -h print this help message -8 output 8 bit per pixel -b enable black columns -r dump sensor registers -t enable cmv test pattern -e <exp> exposure time -m <val> capture mask and value -n <num> number of frames -s <num> shift values by <num> -B <val> register mapping base -S <val> register mapping size -M <val> buffer memory base -Z <val> buffer memory size -R <fil> load sensor registers -P <pat> idle pattern
"./cmv_snap2 -r" without an -e parameter outputs only registers
4 cmv_hist2
Outputs RAW histogram data of the last captured image. Values are tab separated in 4 columns (Order: GRBG[image flip on], RGGB[image flip off]) with 4096 values (when operating in 12 bit mode) each.
Download: http://vserver.13thfloor.at/Stuff/AXIOM/cmv_io2/cmv_hist2
./cmv_hist2 This is ./cmv_hist2 V1.0 options are: -h print this help message -s acquire snapshot -B <val> register mapping base -S <val> register mapping size -M <val> buffer memory base -Z <val> buffer memory size
4.1 Examples
./cmv_hist2 -s
Acquire new snapshot and output histogram
./cmv_hist2
Acquire histogram from last captured snapshot in memory
5 cmv_train2
Executes the LVDS training routines to align LVDS reading timing. Execute this script when the Axiom Alpha prototype is booted up before you capture any images:
./cmv_train2
./cmv_train2 -h This is ./cmv_train2 V1.0 options are: -h print this help message -a test all bit pattern -B <val> memory mapping base -S <val> memory mapping size -A <val> memory mapping address -P <val> training pattern
6 Post Processing images
6.1 Create RGGB separated color images from raw file:
convert -size 4096x3072 -depth 16 -crop +0+0 -sample 2048x1536 gray:colors_500ms.raw16 gray:colors_500ms_ch0.raw convert -size 4096x3072 -depth 16 -crop -1+0 -sample 2048x1536 gray:colors_500ms.raw16 gray:colors_500ms_ch1.raw convert -size 4096x3072 -depth 16 -crop +0-1 -sample 2048x1536 gray:colors_500ms.raw16 gray:colors_500ms_ch2.raw convert -size 4096x3072 -depth 16 -crop -1-1 -sample 2048x1536 gray:colors_500ms.raw16 gray:colors_500ms_ch3.raw
6.2 Simple debayer with ImageMagick:
For flipped images:
convert \( -size 4096x3072 -depth 16 gray:colors_500ms.raw16 \) \ \( -clone 0 -crop -1-1 \) \( -clone 0 -crop -1+0 \) \( -clone 0 -crop +0-1 \) \ -sample 2048x1536 \( -clone 2,3 -average \) -delete 2,3 -swap 0,1 +swap -combine colors_500ms.png
For unflipped images:
convert \( -size 4096x3072 -depth 16 gray:IT8_incand.raw16 \) \ \( -clone 0 -crop -1-1 \) \( -clone 0 -crop -1+0 \) \( -clone 0 -crop +0-1 \) \ -sample 2048x1536 \( -clone 0,1 -average \) -delete 0,1 +swap -combine IT8_incand.png
6.3 Plot Histogram of Raw Image
Create histogram values file with imagemagick:
convert -size 4096x3072 -depth 16 gray:image.raw16 -format "%c" histogram:info: > histogram.hist
Reformat the file:
gawk -F, '(NF>3) { printf "%d\t%d\n", $2/16, $1 }'
Or all in one command:
convert -size 4096x3072 -depth 16 gray:image.raw16 -format %c histogram:info:- | gawk -F, '(NF>3) { printf "%d\t%d\n", $2/16, $1 }' > histogram.info
Then draw it with this gnuplot script:
set notitle set term svg size 1024, 512 set xlabel "Values" set ylabel "Number of Pixels" set multiplot set obj 1 rectangle behind from screen 0,0 to screen 1,1 set obj 1 fillstyle solid 1.0 fillcolor rgbcolor "white" set xrange[0:4096] set yrange[0:8000] plot 'histogram.info' using 1:2 with lines lc rgb "#FF0000" title "name your curve", \ 'histogram2.info' using 1:2 with lines lc rgb "#FF0000" title "name your curve" unset multiplot
execute the script with:
gnuplot thescript > output.svg
7 chroot environment on Axiom Alpha
Full raspian image is available on the alpha prototype in a changeroot environment to keep the core system free from too much clutter.
Download:
http://vserver.13thfloor.at/Stuff/AXIOM/raspian.tar.xz
Preferably download from the alpha prototype directly and upack into /opt/raspian, moving files to the prototype using Filezilla has produced some problems.
Map required folders:
mount -o bind /dev /opt/raspian/dev mount -o bind /proc /opt/raspian/proc axiom-alpha> mount -o bind /tmp /opt/raspian/tmp
Changeroot:
chroot /opt/raspian/ /bin/bash