www.scantips.com

Calculate Distance or Size
of an Object in a photo image

This is rather specialized, but people do ask how to determine or measure the distance or size of an object or subject in a photo image. It is simple math, but it will ABSOLUTELY require knowing accurate sensor size (both the pixel and mm dimensions) and focal length of your camera, which are all important to calculations, but which can be very difficult to determine for automatic cameras, especially cell phones. A camera is really not intended to be a precision measuring instrument. A strong warning about this calculator is necessary: Acquiring the necessary accurate input data for small cameras likely may be difficult, if even possible.

The calculator is below, but there’s lots to get out of the way first

Any meaningful accuracy needs you to be pretty confident that you do in fact actually know your cameras actual sensor size and focal length. Best case for this, you will have a larger camera, like DSLR size, which typically do actually specify this data. But this is NOT an easy question about small cameras, at best difficult and requiring a bit of technical understanding. Before bothering to start calculation here (especially Compact and phone camera users) Please read the Help material below, plus the section following immediately next, for help determining the camera's sensor size and focal length values. It will tell you all I could repeat in email. If your results don't seem reasonable, distrust and verify all of your inputs (including sensor size, focal length, crop factor, aspect ratio, and scene distance). Camera specifications, if even specified, are rounded approximations.

I am trying to discourage attempts expecting that guessed or unknown inputs will produce meaningful accuracy. The data specifications that we think we discovered are often incorrect, again which is more likely true of phone and compact cameras than larger ones. The math is correct, but you MUST have reasonable confidence and knowledge that your input data is in fact accurate data. Calculations absolutely require accurate data. Otherwise, garbage in, garbage out.

First, three very common mistakes to avoid:

There are plenty of issues when trying to determine the sensor size of compact or phone cameras. Also with mixed formats (both video and still photo images from the same camera). For the various calculators here, these Issues of determining camera sensor size are summarized on one place. Please see that if any issues with sensor size.

If you don't know your compact or phone sensors accurate W×H mm dimensions, but you can find the Equivalent focal length (compacts and iPhone typically supply this, in specs or maybe in the image Exif, see the help link here), then consider either of Sensor Size Option 2 or 3 below to compute your sensor size (and specify the correct Aspect Ratio). It can compute your accurate sensor size, and it may be the only manufacturers specification you can ever find for compacts and phones.

But make no mistake (here or anywhere), Equivalent focal length is NEVER to be used as your cameras real focal length (because it is NOT). Equivalent focal length is the focal length used on another camera, specifically a hypothetical 35 mm film camera (which is of known size and is the standard reference of comparison), which will produce equivalent Field of View size on THAT 35 mm film camera. 35 mm film size is just a standard comparison for digital cameras, since many users have years of 35 mm film experience, and this comparison tells them what to expect this digital camera does. The Field of View is what is equivalent on the two cameras. Equivalent focal length is only mentioned here because it is that comparison ratio, from which if known accurately, your camera’s real sensor size can be computed. That’s the only purpose here. But to specify focal length, use only your own cameras real focal length, NEVER specify any Equivalent Focal Length of another camera.

Before you email me, please read the Help material offered here:


The most common blunder when using this calculator is to specify Equivalent Focal Length as your camera's real focal length. Some web sites repeating phone specifications show an Equivalent focal length number instead of the real actual focal length the phone actually uses. But that Equivalent focal length is Not even about your camera, it is simply a comparison to another lens that is instead used on another hypothetical 35 mm film camera (for it to then see the same Field of View that your camera sees). A normal cell phone focal length is typically somewhere around 4 mm, and is NOT any 26 or 28 mm number you might see online somewhere. Beginners apparently hear the Equivalent term and often get the very wrong idea that their lens somehow magically changes to be the Equivalent focal length, but that is impossible, it cannot magically change. This is a common error, so please DO NOT USE EQUIVALENT FOCAL LENGTH as your camera's focal length, as that would be meaningless. Your lens has its own actual real focal length (marked on the lens, or in its specs).

However, from the lens spec, the 35 mm Equivalent focal length / Your Camera's actual focal length is the Crop Factor of your sensor size. These are just comparisons to 35 mm film size. Crop factor describes your sensor size, and it means that the diagonal dimension of 35 mm film (and also the diagonal of the 35 mm field of view, when and if both cameras are using the same lens focal length) are this multiple of your Crop Factor larger than your camera. Users with years of experience with 35 mm film find it useful to know in those familiar terms what the field of view of this digital sensor will now show. But Equivalent Focal Length is not about your own camera, because it obviously must use its own lens instead. However, Crop Factor does compare the sensor sizes directly. And since we know all about the size of 35 mm film, we can then use this Equivalent focal length to get Crop Factor to determine the size of the sensor on your camera, for use with this calculator.

The calculator can compute the sensor size in Option 2 and 3. All you have to do for Option 3 is to enter the specification for the Equivalent Focal Length, and its corresponding focal length of your lens. If a zoom lens, you need to understand that the focal length specifications are the zoom end points, which is probably Not the zoomed focal length your picture just used. I'll repeat this more in the Notes below.


Using this calculator

Restrictions: You need the original digital image. It won't work from a cropped image or a paper print. It won't work correctly for macro distances or for fish eye lenses. The main problem is it won't work correctly for incorrect guesses about sensor size or focal length or subject distances. If you are guessing, you might as well forget it. The object should not be tilted or rotated away from the frontal camera view (which then shows foreshortened size). The calculator works measured in either height or width of the sensor, but not if on an angle.

This calculator can find approximate distance or size of an object in a photo, but the calculator must be accurately told the following things about the situation. I am trying to be discouraging about this or any other similar camera calculation, unless you feel technically capable of actually knowing your actually correct input data values. The math is simple and correct, but the problems are from wrong input data.

You measure the visual size of an object in the image by determining the number of pixels it covers. If it covers 1/4 of the pixels, then it covers 1/4 of the sensor mm. This is easy to do when the photo editors tell you the size of the crop box that you mark. If not, you can actually crop it (tightly around the object) and then look at the cropped image dimensions then (but DO NOT SAVE that edit if you still wish to retain the full original image. Or work with a copy of the file.)

You specify if you are measuring width or height direction, and also how the camera is rotated to determine which dimension is that width or height. Don’t get confused, when the calculator says width or height, it means the literal vertical or horizontal direction you specify.

Describe the camera and situation:

  1. The lens focal length that the image used, in mm. But NEVER use Equivalent Focal Length, use actual real focal length of your lens. At best, this is a rounded specification of the focal length at the infinity focus position. A zoom lens has many focal lengths (the image Exif data should show a crude guess). This camera number is not as precise as you might imagine, especially for zoom lenses.
  2. The physical sensor size, Width and Height in mm. Simpler cameras don’t see any need to tell us this, but some do offer hints of approximations in a 1/xx inch size, or sensor size can be computed from accurate Equivalent Focal Length specs. (We know the full frame 35 mm film frame is 36x24 mm. Different aspect ratios must be considered, but see Calculator 4 here.) See the Help above.
  3. The Sensor image size, Width and Height in pixels. A cropped image cannot be used, the image pixels must match the full mm dimensions and the full pixel dimensions of the sensor (an image “straight out of the camera”, else serious inaccuracy). Some cases also ask aspect ratio of the sensor and image.

    And then, two of these next three, to compute the other:

  4. The distance to that object from camera, in same units as size. Note that the focus distance reported by camera Exif is often not accurate, especially not in zoom lenses with internal focusing.
  5. The real life size of the Object, the actual or approximate estimated Width or Height size dimension, in feet or meters. Not necessarily the "subject", but some known object there. The result will only be as accurate as this estimate. Horizontally skewed or vertically tilted angles will be seen foreshortened, and if not seen at 90 degrees to camera, the real dimension is greater than apparently seen at that angle.
  6. The result size (pixels) of the actual Object in the image. Can be width or height. A resampled image is a special problem, it should be a 100% full sensor size image, as at viewed full size. Again, some photo editors (at least Adobe) will show the pixel size of a crop box as you draw it around the object. Otherwise, you can actually crop the image to object size, and the new image size will be dimensioned in pixels. But DO NOT SAVE that cropped image, cancel out of any save to retain your original image.

The calculator will compute # 4, 5 or 6 from the other five values.

UNITS: Focal length and sensor size are always in mm. Otherwise, the dimensional units outside the lens specify feet or meters, and are suggested, but you can use any external units (including meters or miles or km or cubits, etc). Results will be in those same units. If you understand how, you can enter exponential nomenclature (for example 1.5E4 is 15000). But DO BE CONSISTENT. External distance and size must be in the SAME units (because the dimensional units in the similar triangle in front of the lens cancel out if consistent).

The reason results may not be precisely accurate is that camera specifications round the values of Focal length, Sensor size in mm, and Crop Factor. The calculator uses those rounded values to compute ratio numbers, and then any input errors are magnified in the external field dimension results. It can be close enough, but cameras are Not precise measuring instruments.

Cameras with interchangeable lenses (including DSLR) specify focal length (rounded, and to large extent is just nominal) and actual sensor size W×H in mm, but these tiny values (including their errors) get hugely magnified in the external field dimensions. You should not imagine magical precision from the camera numbers. I wrote the calculator thinking of DSLR camera numbers, and it is just simple geometry, and it works well (if we actually know the accurate input numbers). But compact cameras and especially cell phones don't tell us much about the camera. What we are told about any camera can be a bit crude. Not knowing the accurate input data can be a HUGE problem for calculations. You have to know the data.

Calculate Distance or Size of an Object in an Image

 First select the options to be used:

Find Distance to object
Find Size of object (feet or meters)
Find result Size of object (pixels)

Sensor image size × pixels

Largest sensor mm is Horizontal
Rotated, Largest mm is Vertical

Regardless of this rotation, you are now measuring Horizontally or Vertically

  Select 1 of the 3 sensor size options:

1 Sensor size   × mm
2 Crop factor   

Aspect Ratio 

3   Specs Equivalent Your Lens
Focal Lengths  mm   mm

Aspect Ratio  

Lens Focal Length Used mm
Object H in imagepixels
H of real Object
Distance to Object
 

Any angle: °
is Multiplier:

Numbers only. A NaN result will mean an input is Not A Number. Decimal points are OK.

You must be consistent for all instances, but can use either feet or meters for dimensional units (distance, size), and the results will be in those same units. Sensor size and focal length are in mm.

The options will compute and change the appropriate field, where the Pink background will appear. Any value already in the field you are finding will be ignored and replaced (by computing with all of the other fields). So when it has already computed once, clicking Compute again (or selecting another computing goal) without change can only compute the same matches, with no visible change then, until you change something.

NEVER USE EQUIVALENT FOCAL LENGTH in the field that says "Lens Focal Length Used:". Use the actual number for Your actual lens and sensor.

A red error message fussing about Image and Sensor Aspect Ratios is hopefully diagnosing input typo errors on the sizes. Otherwise, it suggests the image has been cropped to a different size than the sensor. The programs comparison tolerance (for these aspect ratio differences) is 1%, which is about double any expected rounding variations, and hopefully is not too restrictive for normal situations. It still computes then, using pixels to compute object size percentage on the sensor, and then computes all the geometry with the mm size of the sensor. They do need to be the same thing.

Width and Height: Here, width and height means horizontal or vertical in the normally oriented photo image, regardless of how the camera sensor is rotated. Just saying, if the image long image dimension is vertical, that is still "height". Repeating, for the object in the photo image, the calculator asks if you are measuring Horizontally or Vertically in the normally oriented photo image (where Height always runs vertically in the photo image, regardless if that is the long or short image dimension). We normally think of “Sensor Width” as the larger number of mm and pixels, but if camera is rotated up on end, the larger number will become vertical “Image Height”. Either way, object height is always Vertical as the image is correctly viewed. It should be as expected, but to be very clear, the orientation and use of the sensor dimensions will be shown, so you can verify it is specified correctly.

Foreshortening due to angular differences:  This is a difficult problem, try to avoid it, keep the camera pointed level. The calculator does Not compute foreshortening of the object due to angle. The angle to the object might be actual vertical or horizontal camera angle, or it might just be the rotation of the object itself from actual vertical or horizontal (and the worst case is both angles). This paragraph words it as a vertical difference, but exact same is true of horizontal differences too (substitute either word). The camera is assumed level vertically. Then if both the camera back (sensor plane) and the object itself are both vertical, then these are parallel at any object position, so there is no tilting (no walls falling backwards), but larger angles from center can still cause foreshortening of vertical dimensions. Or if the camera is aimed up or down is the same effect (plus or minus angles are the same effect). The angle causes the object pixels to optically measure shorter than it actually is. The correct multiplier computes the actual height dimension. This chart of angles can be a foreshortening guide, which is the angle of the object from the camera (0 degrees is level vertically, or straight ahead forward horizontally). Chart Usage is:

  Actual Height = Apparent measured Height × Multiplier.
  Apparent height = Actual Height / Multiplier.

Photography Tip: If you think to look first, you can see if indoor walls or buildings are skewed and leaning in the viewfinder. This is easy, you can simply Level the camera aim until you see them straighten. Tall vertical objects will still be foreshortened with angle, but will not tilt back then if the camera is level (when the camera back is vertical and perpendicular to the horizontal). To prevent tilted verticals, hold the camera level (which could require turning the camera up on end for greater height range).

Angles are NOT linear changes. If about field of view, using twice the distance or half the focal length doubles the Field of View dimension (dimensions in feet or meters are linear), but the degrees of the new angle is more than double (trigonometry of angle degrees is not linear, each degree from center covers a progressively larger distance span). The foreshortening multiplier also becomes larger with every degree. Except “Small Angles” (defined as less than 10 degrees) can be considered linear. Larger angles are very significantly nonlinear. Don't forget to account for your camera height above ground level.

The sensor size Option 3 is intended to make sensor size be easy for phones and compacts. Some phone cameras (iPhones do, but I think Androids may not) show the Equivalent Focal Length in Exif. Most compact cameras, for example, if the lens specification for your compact is 4.3 mm, and it is said to match the field of view with an Equivalent 35 mm film camera using the 24 mm lens, these are the numbers it wants (the Equivalent 24, and Your Lens 4.3 mm) from your lens specification, as shown in the examples. This procedure only computes sensor size, which is extremely important to calculations. It comes from the spec, and is Not the compact zoom focal length you think you used. If perhaps a compact, your picture may have used one of those end point focal lengths, or used another intermediate one, like 10 mm focal length, and that's the number that the scene description wants (to compute the picture). You must also specify the appropriate Aspect Ratio (normally 4:3 for phones and compacts).

Accuracy: Math is accurate, but input data is less so. You might notice that simply switching between a rotated camera or not can change the computed distance slightly (30.07 to 30.12 in the initial default provided). This is simply because of rounding errors, the aspect ratio in pixels (7360/4912 pixels = 1.4984:1) is not exactly the same ratio as the sensor mm (35.9/24 mm = 1.4958:1). Yet both are camera specifications, and both round to 1.5:1.
Another variable (of a few) affecting computing results is that while zoom lenses focus continually, they report intermediate zoom focal length numbers in several relatively coarse steps (not continuously), which can lose precision then, with the reported value possibly not quite matching the actual number. Very adequate for its design purpose, but it can't be continuous. This is absolutely not an issue for photography, as we judge the viewfinder view without concern about the actual number. However if you're going to compute with it, the real number is useful. The point is, using either end of the zoom range are likely better known values, still rounded, but could be a bit more precise. But published camera specs are typically nominal, perhaps approximate values, or at best rounded values (including focal length, sensor size, aspect ratio, crop factor, equivalent focal length, and distance reported in Exif by lenses). The camera obviously achieves its camera purpose, but it simply is NOT a precision measuring instrument. Do not kid yourself when the calculator shows precision of a couple of decimal places. If you do need precision measuring, you should get a different instrument intended for the purpose.


Example: The calculator initial defaults match this photo example. The tape on the floor in the image measures 30 feet, which is the correct result to compare. If any doubts, you can repeat a similar test.

However, the Exif data says this Focus distance was 3.76 meters, which is 12.33 feet (but is 30 feet when actually measured), so don't trust that number (especially not in zoom lenses. This was a fixed 60 mm lens, but with internal focusing which can also change internal things.) This focus point was on the door knob, center of the frame. Cameras don't know distance, the lens reports its estimate based on how much its focus ring is rotated (which also reads in steps, not continuous)). But with zoom and internal focus changing everything internally, sometimes calibration must be hopeless, and the cameras distance report can be a real crap shoot (often worse than useless). To rely on the distance in the Exif is a probable mistake, and at least you should first actually verify the accuracy of your lens, at various measured distances, and at both wide and telephoto zoom (see more details of my complaining about this. I can ignore that the Exif focus distance number is often inaccurate in zoom lenses, but my complaint is that the camera metering system can actually use that number to override correct TTL BL direct flash exposure, sometimes instead seriously messing it up). Bottom line, do not trust the Exif focus distance number unless you have tested it at the similar zoom and distance.

This door measures 80 inches tall, or 6.67 feet (the size of some things might be reasonably estimated, which then won't be a precise number). In the original full size image, the cropped door is 2724 pixels tall (crop it, then look at cropped image size). Many image editors show the size of the crop box as you mark it, which is sufficient.

Nikon D800 DSLR camera: Sensor 35.9 x 24 mm. 7360x4912 pixels. Nikon 60 mm f/2.8 D lens. Computing distance using sensor Option 1, the calculator input specified 24 mm sensor height, 60 mm lens, 4912 pixel sensor height, 2724 pixel object height, and 6.67 feet estimated real object height.

The tape on the floor measures 30 feet, and the calculator computes 30.07 feet (which is within 0.2%). That 0.07 foot is 0.8 inches, which might be my error, because that distance is computed to the standard Thin Lens node somewhere inside the lens, not really known exactly where it is (but the calculated value is to it, and Not to the focal plane mark at rear of camera). I measured guessing the node was near the middle of lens, which could be an inch error (maybe a few inches in longer lenses). Still, the accuracy seems very adequate (at distance ranges of at least several feet).

Focal lengths are rounded, and in the Exif it says 59.9 mm, which calculates instead 30.02 feet (60.0 mm calculates 30.07, if door precision is entered as 6.67). But the distance is reasonably far, and it is not a zoom lens, so we can imagine it is a reasonable approximation.

I am at fault by speaking of this one result as if it is fully meaningful. The math is easy, but maybe it was a lucky result, and maybe NOT a typical camera result. Because, focal lengths may not be precisely as presented, sensor sizes can be hard to know precisely (especially for small cameras or video), and we tend to guess at all distances and sizes. Things that helped were a prime lens, a DSLR that actually specified sensor size, and an actual tape measure to verify distance and door size. Do not expect camera results to normally be this accurate. This example may verify the math, but cameras have many variables, often not known well enough. And users make errors determining the data too. Think of this camera method as only a rough approximation of distance or size. The only camera specs we need to know are focal length and sensor size, but it seems a lot to ask of simple cameras.

Resampled Images

The image used cannot be a cropped image because we lose the correspondence with sensor size in mm. It cannot be printed, because we lose the object size in pixels. You might imagine some tries at this, but that's just more complication, and I'd suggest it really should be the original image file from the camera.

But for example, the small resampled image copy which is shown above on this web page is 450x300 pixels, and it can actually work too (only if the image is specifically still full frame view, NOT cropped at all). A cropped image cannot work, but a full frame a resampled image might work. The resampled size becomes the new "frame size in pixels", but the sensor size in mm remains the same. Then (in this resampled smaller image) the cropped door is 168 pixels tall, full image height is 300 pixels tall (still representing 24 mm in camera), and calculator says 29.76 feet (0.8%). Less precision in a smaller image or object due to less possible cropping accuracy, even one pixel is a bigger deal then. Still, even this is very near the measured 30 feet.

This 168/300 pixels or 2724/4912 pixels is simply computing the size as 56% of the 24 mm height of the camera sensor. Then knowing 56% of the camera sensor height in mm, and also the real life height, and the focal length distance in camera, it calculates distance to the subject. Such efforts do need to be sure that there was no cropping.

Notes, Especially about Compact or Phone Cameras

Calculators simply MUST be told accurate focal length and sensor size numbers. Garbage in, garbage out. And that means YOU have to know those numbers. And that can be difficult in some cases.

Cameras with interchangeable lenses generally specify all the lens and sensor numbers (or Crop Factor), accurately, even if rounded a bit. But Compact and especially cell phone cameras often don't bother to tell us much. So if using a compact or smart phone camera, or a camcorder, you may not know the necessary numbers for this calculator. Here are some hints about a method that will help determine some usable numbers.

Focal Length: The marked focal length is a rounded number, and that marked focal length applies to focus at infinity distance, and will be a little longer than marked when focused up closer (and about double at 1:1 macro work). So at least a meter or two distance is necessary for the calculator here. If it's a still photo image (not a movie image), the focal length should be shown in the Exif data, which you can see there. Video images don't do Exif, because videos files often include many different camera shots. But for still images, the image Exif data normally shows lens focal length, for compacts and cell phones too (and is likely about all you will ever know about the cell phone lens).

Zoom: If the lens zooms, a complication is that actual focal length will be reported in relatively coarse steps (actual may be between steps). Zoom lenses normally specify their minimum and maximum zoom focal length, but we don't know any other value. These compact cameras do reset to one default focal length when turned on, but which we really don't know that value either. For measurements, your best bet then is to take the picture using only either the most Minimum or most Maximum zoom, since those two end values are reported better in the compact camera lens specification (rounded, but better). But that is speaking of Optical zoom performed by the lens. Any digital zoom is just a resample done by a computer chip (frame size remains the same, but the object in the frame changes size, which totally screws up our effort here). Digital zoom is likely unknown, and that try should be aborted.

Equivalent Focal Length: Compact and iPhone cameras typically report Effective Focal Length in the image Exif data. Which is NOT this cameras focal length, but this calculator can compute the sensor size from it. Not in all cameras, and not all Exif viewers show much, or may not be up to date with modern cameras. In this regard, see my notes about Exif.

Example for the iPhone: The iPhone XR does not specify a 1/xx inch sensor number, but its image Exif reports these next two corresponding values (but which are Not adjacent to each other in the Exif there, you have to hunt a little for each of them):

  Focal Length : 4.3 mm (this is this camera's real number for focal length, found in the Exif)

  Focal Length In 35mm Format : 26 mm (Equivalent Focal Length)

This cameras focal length says 4.3 mm, NOT the 26 mm which it says is for 35 mm cameras (for them to show the same Field of View as this camera with its lens, which is a standard comparison for digital cameras). These numbers are the iPhone XR, other models can vary a bit. Not all phones show this Equivalent Focal Length in the Exif data, but iPhones do seem to, and many compacts seem to, and lenses for larger cameras probably do.

From this ratio of 26 / 4.3, the calculators compute Crop Factor 6.0465, and sensor dimensions of 5.72 × 4.29 mm (for Aspect Ratio 4:3). These numbers are reasonably ballpark for many phones and compacts with similar crop factors, 5.5x to 6x. Finding sensor size can be pretty easy this way. Then the calculators will easily do this for you if you can supply your numbers to use. Since this lens does not zoom, then it’s the one actual real focal length used.

Otherwise, if Equivalent Focal Length is not found, then at least the real focal length should be in the Exif, and maybe the 1/xx inch size is shown in specifications.

The iPhone focal length is certainly NOT 26 or 28 mm, as is commonly misused. The phone body is less than 8 mm thick. Still, the internet has popular sources directly saying the phones focal length is 26 mm. That is absolutely wrong, they obviously don't understand the difference. Or some say it as the "camera is equivalent to 26 mm". That is not wrong exactly (if you realize the 26 mm is mounted on a different camera, not this one), but it is poorly worded, not useful, and it steers beginners wrong. It absolutely does NOT mean THIS phone lens is 26 mm (the phone lenses vary some, but are very roughly around 4+ mm). What Equivalence means is that this camera sees a field of view equivalent to what a 35 mm film camera would see if the 35 mm camera used the 26 mm lens. Assuming familiarity with using 35 mm film, the intended significance conveyed by 26 mm is that it is a wide angle lens (on 35 mm film), more than moderately wide, but substantially less than ultra-wide. Equivalent is the field of view referenced to the different camera. That certainly can be of interest to experienced 35 mm film users (to then know in their terms what to expect from this phone camera), but Equivalent Focal Length is of no use to the cell phone, or to a user who never used 35 mm format (except the 35 mm film format is well known, so we do have one important use for it below, to be able to compute sensor size).

Small cameras often report Sensor Size with numbers for example like "1/2.3 inch". That is NOT an accurate size of a digital sensor. Instead, we need to know the actual exact size of the digital sensor, which must be Width×Height numbers, in mm. Why can't they simply tell us the actual size of the camera sensor?

One method then to approximate the actual sensor Width x Height in mm from that 1/inch number is to try this Wikipedia chart. It can be approximate and incomplete, and different sensors of same description might not be the same exact mm numbers.


The Other Method (which is simple math, and likely better) is to use the Option 3 with Equivalent Focal Length computing sensor size.
Repeating this:

There are issues when trying to determine the sensor size of compact or phone cameras. Also with mixed formats (both video and still photo images from the same camera). Instead of increasing the length of each calculator page affected, these issues are summarized on one place. Please see that if any issues.

More Notes:

Equivalent Focal Length depends on the sensor size and the actual Focal Length being compared. Sensor size is fixed (same one sensor for any zoom). Except new phones with separate Wide and Telephoto cameras use two sensors, which possibly are Not the same size or focal length. Those two Focal Lengths (if used) are surely in the Exif data.

The manufacturer computed Effective Focal Length from actual sensor size and focal length, so this procedure simply reverses that same calculation, which is very valid. The rounded focal lengths can cause the slightest difference, but this is actual manufacturers data, which would seem better than the mythical "1/inch" numbers. The 1% differences mentioned here seem insignificant, and are likely more accurate than your description of the Object in the photo.

Check the Exif data too, but data that comes from the camera manufacturer seems the way to go. Larger cameras normally actually specify the W×H mm sensor size directly, which is a plus (but video formats can still be an issue).

It's just simple math, so if your results don't seem reasonable, verify your inputs (including sensor size, focal length, scene distance and dimensions, and the big difference between focal length and Equivalent focal length).

The Math

People ask about the math in the calculation. The math is similar triangles, for equal opposite angles, which are the same height/distance ratios. It could instead be done with trigonometry, but unless the degrees of angles are to be computed, geometry of similar triangles is the easy way. This same math is repeated and expanded a bit at Field of View Math, so please see that also.

The math the calculator uses is from this diagram:

FOV

Basics of lens optics:   (Dimension is Width, Height, or Diagonal)

Sensor dimension (mm)
Focal length f (mm)
  =  
Field dimension *
Distance to Field d *

* feet or meters (but both are same units)



Substituting an Object size instead of Field size. Using these two steps may be convenient for pixels.

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

Sensor height (pixels)

Object height on sensor (mm)
Focal length (mm)
  =  
Real Object size *
Distance to Object *


Rearrange ratio to compute desired unknown value. Example:

Distance to Object *  = 
Real Object height * × Focal Length (mm)

Object height on sensor (mm)

Real Object height *  =  
Distance to Object * × Object height on sensor (mm)

Focal Length (mm)

* feet or meters (but both are same units)

This only needs the easiest high school math skills. This same material has a little more explanation at Field of View Math, so please see that also (not all is repeated here).

The Object Size should be in the horizontal or vertical plane, meaning Not tilted, angled, or skewed, which is a serious complication. Any camera tilt up or down foreshortens height, and is a complication involving lots more math. If not tilted, these are just similar triangles as opposite angles in the diagram. In the original ratios, the sensor size and focal length are both in mm, which is one ratio. The object distance and real object size are both in either feet or meters, your choice, which is another ratio. Both sides of the lens are the same ratio, so we have an equation. The units work out OK then, we simply rearrange ratios and compute for the unknown. If we know three of the factors, we can solve for the fourth one. The calculator above will do this, but it needs your accurate numbers.

So the easy way is to just use the calculator above. That will still require that you to enter the correct sensor size and focal length of your camera. But if the goal is otherwise, this math part couldn't be easier. The pixels determine the percent of sensor height occupied by the Object. It's the same percentage of the distant field.

The difficult part is determining accurate sensor dimensions and accurate focal length (not easy in simpler cameras). I worry about your finding the right specifications, especially for compacts or phones. Vague questionable input gives vague questionable output. More bluntly, garbage in, garbage out. It won't be greatly precise, but if your results don't seem reasonable, verify your inputs.

Menu of the other Photo and Flash pages here.


Copyright © 2015-2022 by Wayne Fulton - All rights are reserved.

Previous Menu