# What sizes are detectable from 1m using a fairly good cmos camera?

I haven't ordered a CMOS camera module yet, but I am planning to use it to detect a small object from ~1-1.5 meters.

Just too be specific, say I am using the following CMOS camera (although if you know there is better with around the same price I'm open for suggestions):

its 1920*1080p, 120fps(this may reduce the resolution), I plan to use it ~90 degree viewing angle (I had the impression that its adjustable). Lens is "2.8-12mm varifocal". I have no idea about DPI.

Considering other factors are satisfied (such as illumination, colors), what size of objects will I likely to be able to detect in image processing? Would a 2cm object be detectable for example? Is there a way to estimate what size would correspond to a pixel in 1m distance?

• I think this is better suited on physics SE as it is more about optics and not EE. Oct 9, 2015 at 12:02
• Draw a 90 degree angle. Divide it in half (45 degrees each). One metre out along the centreline, draw a line at right angles until it meets the outer lines. Note that the new line is 2 metres long. Divide 2m by 1920. You now have a rough idea of the pixel size. Compare this with your object. Focusing will be important if you want to resolve features as small as a pixel.
– user16324
Oct 9, 2015 at 12:36

If I have followed the idea so far How to detect a bullet in air using proximity sensors, you want to detect an object, about 2cm in diameter travelling at 10m/s.

The resolution of the camera you linked to falls to 640 (H) x 480 (V) at 120fps. Also it is in MJPEG format, so you might need to check that everything adds up (i.e. there is enough processing power) to handle this on your processing board.

As @Brian Drummond explained, for a 90 degree viewing angle, to a point 1m away, by drawing the two 45 degree triangles (with opposite and adjacent 1m long), we can calculate that the view width is 2m.

So at 640x480, a pixel is 2000mm /640pixels; roughly 3mm/pixel, or 6.4 pixels for 20mm (2cm) in diameter. I'd imagine that is easy to detect against a plain, still background.

However, against a background with movement, or moving light (for example the flashing of indoor lighting, which is imperceptible to the human eye, but may be very significant to that camera) it may be much harder.

Also, if the projectile is moving directly towards the camera, it will move about $10m^{-s} / 120f^{-s} = 0.08m$ closer.
So its size will change about 8% (0.08m nearer across 1m starting distance), or change from 6.4 pixels to about 6.9 pixels.

That sort of change may be swamped by the change in indoor light intensity. So, you might recognise something is there, but it might take several frames to figure out whether it is coming closer, or going away.

IMHO, it would be significantly easier to detect a projectile passing across the camera. The most extreme case would be the camera plane and the projectile are parallel, and the projectile will be in different parts of the image on each frame. From this you could derive speed and direction.

Try to design a system where the key information is easy to recover from the sensor data.

Hence, I'd be tempted to use more than one camera to give a reasonable view area, and move them away from the target so that the projectile travels across the image plane of each camera, rather than directly at the image plane. My goal would be to make image processing as simple as a binary image 'diff' between successive frames. That 'diff' would provide much more information than a view directly at a projectile.

Edit:
Are you at college or school? If you are, it may be worth checking to see if they have a Raspberry-Pi, or Raspberry-Pi 2, with a camera (quite a lot of UK schools and colleges bought that sort of equipment). That might be enough for you to do some initial experiments, and derive some real data quite quickly. Further, it might cost no money, and there is a lot of R-Pi enthusiasts who may be able to help when things don't go according to plan. Then, you may soon have a much more 'evidence-based' way to make progress.

• Im a senior college student majoring in EEE and CENG. Raspberry-Pi is a perfect idea for rapid processing. I was considering to do parallel processing with several microprocessors in case processing speed is slow but of course simpler the solution, better it is. Furthermore I might actually try using two cameras since it improves everything significantly. I will program it to entirely change its position (move about 20 cm) in case its shot so I only need to detect 'danger'. Disregarding the color change, I only need to see if there are possible moving bullets in say 3 frames in a row. Oct 9, 2015 at 19:28
• Of course it may fail and I might end up having it evading only slow tennis balls but I will push the limits as much as I can. I will try to remember and share the link in my first post after the project is done(its a 1 yr project and evasion is a part of it, so even the entire set up fails I probably still would not have any problem having a good grade due to other parts since they are relatively lot easier). Oct 9, 2015 at 19:32
• Try to get some data in the next couple of weeks, using equipment on hand. If you are anything like me, trying to solve all of the key problems, by trying to get some real data causes me to discover all of the things I hadn't thought of. If you can lay your hands on enough R-Pis+cameras, then you can do plenty of parallel processing. I don't know if the cameras scan can be controlled well enough, but if it can, two R-Pi+camera could take a picture at the same time, to give consistent position and time. With even more, they might be staggered in time to give a higher frame rate. Best of luck Oct 9, 2015 at 23:36

If you look at the eighth line in the data you provided, you'll see that the viewing angle can be adjusted over a 30 to 150 degree range. For the moment, I'll assume that this angle is the angle for the horizontal axis, although it's entirely possible that it's for the diagonal of the picture.

Then at 1 meter, the horizontal aspect at 30 degrees will provide a length of $$L=1\text{ meter} \times 2\times\tan(15) = .536\text{m}$$ and pixel size P is$$P = \frac{.536}{1920} = .28\text{mm}$$ Likewise, at 90 degrees (which is clearly possible) $$L=1\text{ meter} \times 2\times\tan(45) = 2\text{m}$$ and pixel size P is$$P = \frac{2}{1920} = 1.0\text{mm}$$

There are a few caveats here. First, it is by no means certain how good the resolution of the lens is, but at 30 degrees you have about a factor of 72 to play with (.28 mm vs 20 mm), and at 90 degrees you have a factor of 20 , so I'd be very surprised if you can't get usable results. Second, there is no guarantee that you can focus as close as 1 meter. I'd be surprised if it can't, but like I say there is no guarantee. The link is silent on this.

• Thanks a lot, even if it cannot focus as close as 1 meter, I can still find another camera that could. I liked the approach and its good to know what I am intending to do will be possible :) Oct 9, 2015 at 21:42
• @OE1 - Please see edit. I used sine when I should have used tangent. Sorry. Oct 9, 2015 at 21:50
• I figured, still leads to same conclusion though. Thanks again. Oct 10, 2015 at 6:12