# Camera sensor size vs pixel size and focal length [closed]

I've already seen the answer about the crop factor.

I'm writing a small software for motion tracking (from two cameras, videos) in 3D space and research. To do that, I need some information about cameras. Sensor size and pixel size relationship is one of them.

For some things, I need the sensor size, for other, pixel size, elsewhere, focal length. I need to understand if and what is the relationship between the two, and is it possible to calculate one or another.

At the moment I have a plain Canon A720 IS. The listed focal length is 5800, sensor size is 1/2,5'' (5.744 x 4.308 mm) and the pixel size i 3,1µm² (~1,76µm). How are these numbers related (mathematically)? Is there a way to calculate pixel size from the sensor/resolution/focal length/whathaveyou?

PS: After calibrating my camera with OpenCV (inaccurately, but close enough for debugging), I got a focal value of 633. This has to be multiplied by sensor size, so I end up with a value of 253,2. How is this related? This is nowhere near 5800µm, Canon-listed focal length, and 4620µm, for which I am getting the most accurate 3D positions.

• See What is “angle of view” in photography? for a visual explanation of how focal length relates to sensor size. Jul 14, 2015 at 14:10
• Jul 14, 2015 at 20:23
• @mattdm how is that related to the relationship between pixel size and sensor size? Also, I have focal length, I even have three, the problem is I don't know which one is true. Jul 14, 2015 at 20:49
• Let me step back a bit. How do you think these values might be related? Jul 14, 2015 at 21:00
• @mattdm I don't know. That's why I asked in the first place. Pixel size... I don't know. Sensor width/height divided by the amount of pixels on the matrix. However, the matrix is bigger than the picture it takes... isn't it? calibCamera value * sensor size should give me the focal length, but I get different result from that... so that's something I also asked about. Jul 14, 2015 at 21:09

## 1 Answer

Those numbers aren't directly related in any way:

• The sensor size is the physical size of the sensor.
• The focal length is how much the lens is magnifying stuff. Note that the A720 has a zoom lens with a focal length which varies from 5.8 mm (5800 µm) to 34.8 mm.
• The pixel size is the size of each individual pixel on the sensor. This obviously relates to the overall sensor size, but only by the number of pixels on the sensor. Without that, they're independent numbers.
• That's depressing. And sorry, I've missed µm. 5,8mm is 5800µm. Jul 14, 2015 at 11:44
• @Petersaber It's basic geometry. If that's depressing... well, life is going to be hard for you in general! Jul 14, 2015 at 14:09
• @mattdm "Those numbers aren't directly related in any way" - that's depressing. I can't have the users of my app dump the entire specification of their cameras... sure, I can get pixel size, but I need to know the total resolution, and not just the picture, right? And the focal length numbers I got just don't match, doesn't matter how I do them. Jul 14, 2015 at 20:19
• Your alternative is to have a large database of values. How do you imagine this working? Jul 14, 2015 at 20:26
• @mattdm user inputs a video with a checkboard, inputs sensor size, OpenCV computes what I need using the checkboard calibration. One of the reasons I am asking this question is to confirm I got the good results. Another option is (both will be included in the end app) user inputs focal length, sensor size, pixel size, (preferably only sensor size, as pixel size varies madly from source to source), and simplefied math takes over. Jul 14, 2015 at 21:14