Skip to content

08.2 Measuring using pinhole camera model

ruiprieto edited this page Dec 17, 2018 · 13 revisions

Using the simplest model, a pinhole camera, the size of the camera sensor and lens focal length coupled with distance to object determines the image scale or the resolution of the image.

The scale of an image is the ratio of the distance on the image to the corresponding distance at the object plane.

In the figure above, the distance 'AB' will be projected on the camera sensor on line 'ba', therefore, the image scale can be computed using the following formula:

  • Equation [i]: scale = (distance ba)/(distance AB)

Using the similarity of triangles principle, it is also easy to conclude that

  • Equation [ii]: scale = (lens focal length: f)/(distance to object: D)

Thus, it is possible to resolve for the distance AB

distance AB = [(distance to object: D) x (distance ba)] / (lens focal length: f)

AragoJ uses that principle to convert pixel units to the metric system. Using information on the camera geometry and distance to object, the scaling factor is computed using the following equation:

[EQ 2]

where L.m [distance 'AB' above] stands for the length of the object in meters (m); L.px [distance 'ba' above] the length of the object in pixels; Sw is the width of the camera sensor in millimetres (mm); D the distance of the camera to the object (in meters); Fl the camera focal length (in millimeters); and imW the image width in pixels (by dividing the sensor width [in mm] by image width [in pixels] we obtain the pixel size in metric units).

ß in [EQ 2] is a correction factor for the camera to object distance. It can be useful in cases where a correction has to be applied to the distance to object measurement. For example, the height reported by a barometric altimeter, often used in drones, is referenced to the take-off location and can differ from the true height of the drone relative to the location where the image was taken (which is equivalent to the distance 'D'); if that difference is known, ß can be used to correct for that. If no correction is necessary, the field for ß should be left blank or set to 0.

The Module for scaling measurements using the geometric principles above is called D/f in AragoJ and is found under the Module menu:

  • Module->Scale->Ratio D/f

and once it is invoked the following box opens

The Camera Sensor Width, in millimetres (mm), must be provided. It may be stated in the camera manual or it may part of the EXIF metadata. If necessary, a good database of camera sensor sizes is maintained by OpenMGV.

Camera Focal Length, in millimetres (mm), can be imputed either manually or using the drop down menu to query the image EXIF information. Make sure that this information is accurate because even small changes in this value may have a big effect in the final result.

Distance to object, in meters (m) can also be imputed manually or using the EXIF information (depending on camera model the distance/altitude may be recorded with other EXIF metadata).

The Correction Factor ß, can be set to any value in meters (m). If no correction is necessary, leave the field empty or set it to 0.

It is possible to set a common scale to all pictures in a Session by checking the ‘Apply to all’ tick box. This is especially useful if pictures are all taken at constant distance from object to camera (for example, animals moving through a single working alley or an aircraft flying at a constant height).

Currently the Preset drop-down menu is inactive. In a future release, it will be possible to save the camera settings and recall them using this option.

Clone this wiki locally