0

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.

Petersaber
  • 103
  • 1
  • 5
  • See What is “angle of view” in photography? for a visual explanation of how focal length relates to sensor size. – mattdm Jul 14 '15 at 14:10
  • @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. – Petersaber Jul 14 '15 at 20:49
  • Let me step back a bit. How do you think these values might be related? – mattdm Jul 14 '15 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. – Petersaber Jul 14 '15 at 21:09
  • I'm voting to close this question as off-topic because it doesn't appear to be actually related to photography – Joanne C Jul 15 '15 at 10:20
  • JoanneC: do you have a suggestion where else could I ask about focal lengths, sensors, pixel sizes, etc etc? While the nature is software development, the topic is "using photographic equipment", listed in the link you've provided. Software development is not a standalone thing. You don't write code about code, you write code about, in this case, a topic directly and strongly influenced by camera parameters. There's an app for everything - thus it's illogical to exclude programming from discussions and forums about X, as X eventually gets software made for it – Petersaber Jul 15 '15 at 10:27
  • @Petersaber - I don't have a suggestion on site, but the question isn't actually about using the equipment and, even with that, the implication is about using it in a photographic context. I'm not sure that I see the connection as asked. You can try editing to bring it more in line, and usable, from a general photography perspective, we have reopened questions that have appeared off topic before. – Joanne C Jul 15 '15 at 10:32
  • JoanneC: I am using photographic equipment to calculate 3D positions of certain objects for research. To do that I need to analyze recorded videos, frame by frame (as individual pictures, not a video). The only reason I am using videos is because I can't get 120+ pictures per second with what I have. I honestly don't know if a frame can be treated as a photograph. It's a still picture, I guess so, but that's only my opinion. If that's not relevant enough, then by all means, close the topic, but at least point me in the right direction. – Petersaber Jul 15 '15 at 10:40
  • JoanneC: my problem is divided between multiple fields, and I figured I'd ask where people know the most about the technical aspect, as I can do both coding and math myself (as long as I know what I'm trying to actually do, and for that, I need this question answered) – Petersaber Jul 15 '15 at 10:42
  • To be honest, I think the question has been answered. In any event, we're one of the oldest sites on the network and whether or not these are considered on topic has been hashed out a number of times. – Joanne C Jul 15 '15 at 13:56
  • JoanneC: I guess. I had hoped against hope that someone might've had a better answer, or some odd math way that would allow me to indirectly calculate everything I need, but I guess I'll have to ask OpenCV guys instead (as OpenCV docs are... not very well written. And have errors) – Petersaber Jul 16 '15 at 06:37

1 Answers1

2

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.
Philip Kendall
  • 21,867
  • 6
  • 67
  • 101
  • That's depressing. And sorry, I've missed µm. 5,8mm is 5800µm. – Petersaber Jul 14 '15 at 11:44
  • 1
    @Petersaber It's basic geometry. If that's depressing... well, life is going to be hard for you in general! – mattdm Jul 14 '15 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. – Petersaber Jul 14 '15 at 20:19
  • Your alternative is to have a large database of values. How do you imagine this working? – mattdm Jul 14 '15 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. – Petersaber Jul 14 '15 at 21:14
  • Let me rephrase. How do you imagine that these things would be related such that it would work this way? – mattdm Jul 14 '15 at 21:52
  • @mattdm If I knew I wouldn't be asking the question, now would I? – Petersaber Jul 15 '15 at 06:04
  • @Petersaber You probably don't care about actual photosite size; you only care about percentage of frame represented by each pixel, right? Or are you trying to go to the real world size represented by a given pixel at a given distance? – mattdm Jul 15 '15 at 09:33
  • @mattdm I need the size of a pixel at distance = 0 (at least that's what I was led to believe). I got the most accurate results for pxSize = 1.69, which is pretty close to sqrt(3.1µm) I found somewhere. Is the distance 0? I can only guess. – Petersaber Jul 15 '15 at 10:03