This posting is sneak preview on Raspberry v1 camera doing 180fps at 640x240 (PS3 Eye camera can do 187fps at 320x240: viewtopic.php?t=193033#p1211878). "raspivid" can do maximal 90fps, and OV5647 datasheet states 120fps as maximal for 320x240 ...
I looked into the Raspberry camera video modes table, and mode 4 and 5 differ by 240 pixels vertically only:
Code: Select all
4 1296x972 4:3 1-42fps Full 2x2
5 1296x730 16:9 1-49fps Full 2x2
Then I copied out sensor_regs ov5647_mode4 and sensor_regs ov5647_mode5 from raspiraw.c.
The diff shows only 5 registers different:
Code: Select all
$ diff --side-by-side -W 74 mode4.txt mode5.txt | grep "|"
struct sensor_regs ov5647_mode4[] | struct sensor_regs ov5647_mode5[]
addreg(0x3802, 0x00), | addreg(0x3802, 0x78),
addreg(0x3806, 0x07), | addreg(0x3806, 0x06),
addreg(0x3807, 0xA3), | addreg(0x3807, 0xB3),
addreg(0x380A, 0x03), | addreg(0x380A, 0x02),
addreg(0x380B, 0xCC), | addreg(0x380B, 0xDA),
$
I did similar changes for mode7 (changed framerate in addition) and added new mode8 for that, for capturing 640x240 video. While raspiraw output still reports the same big "filled" frame size for 640x480 ...
Code: Select all
...
mmal: Buffer 0x6efef0 returned, filled 384000, timestamp 1101163220, flags 0084
mmal: Buffer 0x6f00c8 returned, filled 384000, timestamp 1101168766, flags 0004
mmal: Buffer 0x6f02a0 returned, filled 384000, timestamp 1101168766, flags 0084
mmal: Buffer 0x6efd18 returned, filled 384000, timestamp 1101174311, flags 0004
...
... it really records 640x240 frames, and at 180fps!!!
Code: Select all
$ bc -ql
1000000/(1101168766-1101163220)
180.31013342949873782906
1000000/(1101174311-1101168766)
180.34265103697024346257
Here is "/dev/shm" proof for really getting frames stored with 180fps in ramdisk:
Code: Select all
$ rm /dev/shm/out*
$ time ( raspiraw -md 8 -hd -t 3000 -sr 1 -o /dev/shm/out.%03d.raw )
...
mmal: mmal_port_free: vc.ril.video_render:ctr:0 at 0x98b140
real 0m3.089s
user 0m0.190s
sys 0m1.460s
$ ll /dev/shm/out.*.raw | wc --lines
540
$
Now what do we get with 180fps?
This is 640x480 frame at 60fps, same view, same light, converted with dcraw:

And this is 640x240 frame at 180fps, converted with dcraw:

What can be seen is that this is exactly the top half of previous 640x480 frame. And that I have to play with gain and exposure.
But even these 180fps frames as they are would be good enough for my target application of high speed robot following 1.5cm wide black line on white ground:

I took 10 consecutive frames from the 180fps capture, used dcraw to convert to .ppm, did "pnmquant 256 | ppmtogif" to get .gif frames and finally used "gifsicle --colors 256 -l -d 100 ..." to get this animated gif looping with 1 frame per second (the conversions reduced color quality, but this should demonstrate that video is really stable, I moved my finger up and down fast during recording):

After fixing raspiraw to store only the real frame data (plus header for dcraw) ...
Code: Select all
$ bc -ql
(384000/2+32768)*1800/1024
395100.00000000000000000000
... more than 10 seconds of recording will fit into "/dev/shm":
Code: Select all
$ df /dev/shm
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 448396 0 448396 0% /dev/shm
$
The "dcraw" conversion can be done on SD card without space restrictions, afterwards.
So this fast recording is good on its own.
Of course raspiraw can be used without storing frames in order to process frames on the go and do robot control with them. In theory robot camera tilt calibration should be doable three times faster than before (servo motor control was done raspiraw frame wise at 60fps):
viewtopic.php?f=43&t=189661#p1231151

Currently I have 5 v1 camera modules only (1 NOIR), but maybe after Christmas I will be able to do measurements and changes for v2 camera as well.