I am working on a project that needs to capture an array of pixels 30x4 at several hundred frames per second. I am not interested in color so that should lower the amount of processing the Arduino has to do. My question is how do I go about this. From what I read CMOS captures individual pixels while CCD reads the whole image at once. Is there any way to just capture a few select pixels at a higher frame rate then capturing the whole image. Thanks in advance for any advice. The CMOS camera I was thinking of is the OV7670.
How many bits are there for each pixel? Colour would generally involve 24 bits.
How do you envisage connecting the camera (or whatever) to the Arduino?
My first thought is that the Arduino may not be fast enough or have enough memory.
It would be eight bit grayscale at the most, possibly just two bit. Since the amount of pixels I will be reading is very few and I won't be doing image processing and the memory won't be a lot either. I am reading an area of 30x4 pixels or smaller so at 8 bit grayscale it would come to 120 bytes for the whole thing.
Arduinomonkey: to capture an array of pixels 30x4 at several hundred frames per second. ...it would come to 120 bytes for the whole thing.
And those 120 bytes will be flying in at [u] x [/u] bits / sec.?
There are line-scan image sensors and cameras http://www.sensorsinc.com/linescan.html http://www.hilltech.com/products/electro_optics/linescan_cameras.html http://www.edmundoptics.com/imaging/cameras/line-scan-cameras/basler-runner-line-scan-gige-cameras/3248 http://www.parallax.com/Store/Sensors/ColorLight/tabid/175/CategoryID/50/List/0/SortField/0/Level/a/ProductID/566/Default.aspx http://www.fairchildimaging.com/files/ccd111datasheetreva.pdf
If you were going to work with "composite video" (which is nowhere near "several hundred frames per second"), you could try counting lines and timing for a capture period during a particular line: http://www.intersil.com/content/dam/Intersil/documents/fn70/fn7010.pdf http://www.ti.com/lit/ds/symlink/lm1881.pdf
How this 30 x 4 organized over video frame? 30 pixels on line, 4 lines? If it's true, how 30 pixels compacted , I mean average video line compose of 400 pixels (TV quality), your pixels side by side or distributed all over?
I thought from your original post that you wanted to read the 120 bytes several times a second. That gets way beyond the storage capacity of an Arduino pretty quickly.
If you are thinking the Arduino might pass them on to something else, have you considered how fast (or slow) that would be?
Arduinomonkey: It would be eight bit grayscale at the most, possibly just two bit. Since the amount of pixels I will be reading is very few and I won't be doing image processing and the memory won't be a lot either. I am reading an area of 30x4 pixels or smaller so at 8 bit grayscale it would come to 120 bytes for the whole thing.
From the product brief of that camera
The OV7670 can operate at 30 frames per second (fps) in VGA with full user control over image quality, formatting and output data transfer.
From your initial post:-
to capture an array of pixels 30x4 at several hundred frames per second.
How do those two facts square up?
I won't be doing image processing and the memory won't be a lot either.
What are you doing with it. It is 120 bytes per frame and at several hundred a second they will soon add up. Or are you thinking of transferring them to another device? In which case can you say how many hundred times a second and then work out the transfer rate you need.
I am trying to to make an optical flow sensor that reads a few pixels ( in this case 30x4) and then compares it to the previous frame and then discard the old frame. By 30x4 I mean thirty pixels in a row and four deep At any one time there will be only 2 frames stored in memory. Want I want to make is an optical flow sensor that tracks a series of parallel bars to see if and how far it has traveled since the last frame. I would use a mouse sensor but most don't have enough pixels ( in the future I might want 120x1 or 60x2) and if you want to read the individual pixels you need to do it over serial which is too slow. The OV7670 says it can read 640x480 and 30fps per second at the highest clock speed but if you lower the clock speed it reads slower. My question is 30fps the maximum frame rate for reading all the pixels (640x480) or is it the maximum frame rate period.
My question is 30fps the maximum frame rate for reading all the pixels (640x480) or is it the maximum frame rate period.
Is it me with low vitamins level, or it's written in Greek? What does it means frame rate period? :) fps - frame per second, in other words frequency. Period, reverse value of that 1 / frequency. Frame must include all pixels 640x480.
In those sort of chips you have to read out all the pixels you can not choose what you read out. Now that is too fast for an arduino but you could capture one coloum of pixels per frame or even part of a coloum. But that means you only get your patch every 30 / 4 times a second.
What you describe is image processing, in effect it is frame subtraction followed by anailisis of the difference image. This is a technique I used in the 80s for analysing movement of medical images.
If you want a faster frame rate then you will have to pick another imaging device.
After you've found a digital high speed camera capable of dealing with that high frame rate, I think you'll need some sort of frame buffer so that your Arduino can pick out the pixels it is interested in. The Nootropic Video Experimenter is the only one I know of, but you may find you need to use a Mega based Arduino to get enough RAM and it is only compatible with a few of them.
I would have though that a PC would be a much better basis for this project. It gives you much more resources for data processing and image recognition, a much bigger development community (which translates to more readily available software and more support), a much wider range of standard hardware interfaces and drivers, and if you use an embedded PC such as an RPi it needn't be much bigger than an Arduino.
Sounds like a job for an optical mouse sensor. They have very high frame rates (>1500 fps) and capture at low resolution.
I agree that Arduino's are generally too slow for video processing.
I don't know whether it really is not possible to read only part of frame from OV7670 (I have some, but never got them working). But this is definitely possible for Raspberry cameras, 5MP v1 camera as well as 8MP v2 camera.
And even a 5$ Pi Zero is capable of processing 502fps with (5$) v1 camera for 640x64 frames (a Pi 2B can do 665fps for that resolution). I prefer 640x128_s format, that is only every other of the 128 lines gets captured, and the frame needs to be stretched (doubling every of the 64 lines captured) afterwards. This is my bookmark page with much information and links (@6by9 recently merged all my high framerate work to raspiraw master branch with quite some documentation): http://stamm-wilbrandt.de/en/Raspberry_camera.html
I will use the Pi Zero with v1 camera as high framerate video processing subsystem for the robot pointed to in my signature, and an Arduino Due will do the PID motor control based on the extracted information (not the frames) from Pi Zero.
Just to give an impression here, this is Raspberry v1 camera (raspiraw) 640x128_s slowmo of classic mouse trap recorded at 665fps, played at 25fps (26.6 times slower than real), showing wood splintering from mouse trap plate:
You can single frame step fore/back in youtube video, description tells you how (there are 1503μs between consecutive frames): https://www.youtube.com/watch?v=khFUlkh-QeU
Back to the subject of this thread, maximal 750fps can be achieved for 640x32 on Pi 2B without frame skips, but I once did a 900fps video with only 97 frameskips of 7171 from 8s recoding: https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=109523&start=25#p1246776