Skip to content

Calculating height from pixel height

Helen Burns edited this page Aug 29, 2024 · 7 revisions

Thin Lens Equations

Height (mm)= (Distance to Object (mm) x Object height on sensor (px)) / Focal Length (mm)

Object height on sensor = (Sensor height (mm) × Object height (pixels)) / Sensor height (pixels)

The height of an object in a photo is related to its object height on sensor, the distance to the object and the focal length. This assumes that the camera is parallel to the centre of the photo. However as our camera was pointed to the sky we must use some geometry to adjust for the pitch of the camera.

The field of view angle (α) can be calculated from the sensor height and focal length. From the recorded pitch we can use trigonometry to work out the adjustment to find x from the calculated height, pitch and field of view angle.

Camera info

The infomarmation required can often be found in the photo metadata on linux we used the exif tool. Or the details are likely recored on the manufactor's website. E.g.

https://www.digicamdb.com/specs/canon_eos-6d-mark-ii/

26,200,000 photosites (pixels) on this area 861.6 mm2. distance between pixels: 5.73 µm

  • Image width x height: 6240 x 4160
  • focal_length_mm = 50 Focal Length in mm
  • sensor_height_mm = 24 Sensor height in mm
  • sensor_width_mm = 35.9 Sensor width in mm

Sensor height (px) = Sensor height (mm) / distance between pixels

sensor_height_pixels = 2410**-3 / 5.7310**-6

sensor_height_pixels = 4188

Data required to calculated the height of object

To calculate the height of the object we'll need the above information about the camera and the pixel height and distance between camera and object.

References

  • Fundamentals of Photonics, Bahaa E. A. Saleh and Malvin Carl Teich, 2007, FOV diagram
  • Introduction to Modern Optics, Author: Grant R. Fowles, Dover Publications, 1989 - thin lens equations