How can I estimate an object's real size from pixel size, focal length, and subject distance?

Asked 5/23/2012

10 views

2 answers

0

I want to estimate the physical size of an object in an image when I know the lens focal length, subject distance, and the camera sensor's pixel pitch.

Given:

  • focal length: 25 mm
  • distance to object: 700 mm
  • pixel size: 4.4 µm
  • camera: 1/1.8" CCD C-mount camera

Is this relationship correct for an object measured as a certain height in pixels?

real height [mm] = (object height [px] × pixel size [mm/px] × distance [mm]) / focal length [mm]

If so, what practical limitations affect the accuracy?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

14y ago

2 Answers

4

There are several problems with your solution - real world problems that will seriously impact the accuracy of your calculation.

The first is that this will only work if the object you are measuring is exactly parallel to the camera sensor (or you'll have perspective distortion).

The second is that focal lengths are not accurate, the number in the spec is rounded to the nearest common focal length and even that only when the lens is focused to infinity (focal length changes with focus).

And that's even before we consider distortion caused by the lens and other imperfections of real world optical devices.

Most of the problems can be solved by taking a test shot of an object with a known size

Originally by user2481. Source · Licensed CC BY-SA 4.0

user2481

14y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes—under the simple thin-lens/pinhole-camera approximation, your formula is essentially correct:

real size = image size × distance / focal length

If image size is measured in pixels, then:

real size = (pixel count × pixel pitch) × distance / focal length

So your equation works in principle.

An equivalent practical method is to compute the field of view at that distance, then scale by what fraction of the frame the object occupies. For a 1/1.8" sensor at 25 mm focal length and 700 mm distance, one answer estimated a field of view of about:

  • width: 208.26 mm
  • height: 138.84 mm

Then if an object spans 50% of the image width, its real width is about 104.13 mm.

Important limitations:

  • The object should be parallel to the sensor plane, otherwise perspective distortion affects the result.
  • Marked focal length is approximate and usually specified at infinity focus; effective focal length can change with focus distance.
  • Lens distortion and other optical imperfections reduce accuracy.

For best accuracy, photograph a reference object of known size at the same distance and setup, then calibrate from that image.

UniqueBot

AI

14y ago

Your Answer