How can I estimate an object's size in pixels from its real size, distance, and camera settings?

Asked 6/12/2017

8 views

2 answers

0

I want to estimate how many pixels wide/high an object will appear in a photo. I know the object's real size (x by y in meters) and the distance from the camera to the object (d, in meters). What other camera information do I need to calculate the object's size in pixels? Do I need focal length, sensor size, crop factor, image dimensions, or PPI?

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

Photography Stack Exchange contributor

9y ago

2 Answers

4

If you know the actual width or height and camera-to-object distant, you can easily calculate a ratio size-to-distance.

Say a object is 3 meters wide and a picture is taken with the camera positioned 12 meters from the subject. The ratio size-to-distance is 3÷ 12 = 0.250.

Inside the camera, the image forming rays from the lens, trace out the same ratio as they travel. In other words, the projection distance inside the camera and the image size yield the same ratio. If one of these values is known, the other is easily calculated.

Likely, of the two, the projection distance is the most easily discoverable. This will be the focal length of the lens at the time the picture was taken.

Suppose the camera’s zoom lens was set to 50mm (or a prime 50mm was used). The span of the projected image will be 50 X 0.250 = 12.5mm.

From the camera specification sheet, we can discover the pixel pitch. Suppose the center-to-center pixel spacing is 3.89 µm (micrometers), 0.00389mm.

Now we calculate the span of the image in pixels is 12.5 ÷ 0.00389 = 3214 pixels (rounded up).

The span of the image covers 3214 pixels = 12.5mm

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

user44949

9y ago

0

AI Answer

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

Yes — distance and real object size alone are not enough. You also need the camera’s imaging geometry, especially the focal length (or field of view), and then the image/sensor pixel dimensions.

A simple approximation uses similar triangles:

image size on sensor / focal length = real object size / subject distance

So for width or height:

image_size_on_sensor = real_size × focal_length / distance

That gives the object’s projected size on the sensor in mm or m. To convert that to pixels, you must know pixel density on the sensor, or equivalently the sensor’s physical size and the image resolution:

object_pixels = image_size_on_sensor × (image_pixels / sensor_size)

PPI is usually not useful here; it describes print/display density, not how many pixels the camera captured. Crop factor by itself also isn’t enough unless you use it to derive the actual field of view from focal length and sensor size.

So in practice, you need:

  • object size
  • camera-to-subject distance
  • focal length (or field of view)
  • sensor size and image resolution

Then calculate projected size on the sensor, and convert that size to pixels.

UniqueBot

AI

9y ago

Your Answer