How to calculate size of objects in digital photo

In summary, the conversation revolves around determining the distance between a model and a camera that will result in a one inch per pixel ratio. Moe points out that using a 20 megapixel camera and a 50mm lens, the model's one inch buttons will only show as one pixel in the image. They discuss using a laser rangefinder and a corner reflector to determine the distance, but ultimately realize that there is no formula that can accurately predict the level of detail in an image. It depends on various factors such as lens quality and file compression.
  • #1
Suppaman
128
11
TL;DR Summary
How to calculate the distance in feet between the model and the camera that results in a one inch per pixel for the given parameters.
Please move to a better forum if available.

We have two friends discussing their photography efforts.

"you know that your photo of people with large one-inch square buttons on their coats will not look accurate," said Moe.

"Why is that," asked Curly.

Moe answered, "You have the model standing (feet?) from the 20 MegaPixel camera using the fifty-millimeter lens, and their buttons will show as one pixel in the image. You need to move the camera closer."

How to calculate the distance in feet between the model and the camera that results in a one inch per pixel for the given parameters. What is the formula?
 
Mathematics news on Phys.org
  • #2
A couple of things:

1] I'm not sure about the premise of your scenario. Why would 1 pixel buttons not look accurate? Are you perchance supposing they'll look like perfect little squares? They won't - for several reasons.2] You'll only get an approximate answer, unless you were to specify some more parameters, such as aspect ratio.A very rough answer (I know of no formula that could do this):

A 50mm lens is pretty close to how a human sees the world, so we'll neglect lens distortion due to focal length.
A 20MP sensor at 4:3 ratio will have approx 5200x 3900 pixels.

For a scene to render at 1px per inch on that sensor, it would have to subtend 3900 inches (or 325 feet) top-to-bottom.

Using an isosceles triangle calculator, I get a "height" of 325, and a base angle of 50, which gives me a subject-distance of approx. 194 feet.
 
Last edited:
  • #3
DaveC426913 said:
A couple of things:

1] I'm not sure about the premise of your scenario. Why would 1 pixel buttons not look accurate? Are you perchance supposing they'll look like perfect little squares? They won't - for several reasons.2] You'll only get an approximate answer, unless you were to specify some more parameters, such as aspect ratio.A very rough answer (I know of no formula that could do this):

A 50mm lens is pretty close to how a human sees the world, so we'll neglect lens distortion due to focal length.
A 20MP sensor at 4:3 ratio will have approx 5200x 3900 pixels.

For a scene to render at 1px per inch on that sensor, it would have to subtend 3900 inches (or 325 feet) top-to-bottom.

Using an isosceles triangle calculator, I get a "height" of 325, and a base angle of 50, which gives me a subject-distance of approx. 194 feet.
Assume all pixels are used. Full frame.
 
  • #4
Suppaman said:
Assume all pixels are used. Full frame.
Yes. No. That does not help.
 
  • Haha
Likes berkeman
  • #5
Just as an image from an orbiting camera has limits on the smallest object it can see, this is sort of the same question. I am looking for a way to tell how much detail will be available using a formula.
 
  • #6
DaveC426913 said:
Yes. No. That does not help.
I do not think the pixels know how an image may be cropped. Assume the image is not cropped, same size as the sensor.
 
  • #7
DaveC426913 said:
A 20MP sensor at 4:3 ratio will have approx 5200x 3900 pixels.
So a couple test photos will answer this pretty easily. @Suppaman -- have you or your friends taken a few test pictures as a sanity check on any formulas that you hear about or come up with?

When I extend my arm 1 meter out from me and hold my pointer/thumb tips 2mm apart and that matches the height of a 6 foot tall human in the distance, I can figure out how far they are away from me... :wink:
 
  • #8
I have a laser rangefinder and a mirror that reflects it back along the same path so I can tell how far away something is. I could take an image of a postage stamp at some distance and look at it in my editor to see how many pixels it covers, But a formula must be available and I do not see how aspect ratio changes anything.
 
  • #9
Suppaman said:
I have a laser rangefinder and a mirror that reflects it back along the same path so I can tell how far away something is. I could take an image of a postage stamp at some distance and look at it in my editor to see how many pixels it covers, But a formula must be available and I do not see how aspect ratio changes anything.
Sorry, I'm not understanding yet. Laser rangefinders work via time-of-flight, not beam spreading. Reflection from a cube corner would affect beam width anyway. How are you wanting your laser rangefinder to operate?
 
  • #10
berkeman said:
Sorry, I'm not understanding yet. Laser rangefinders work via time-of-flight, not beam spreading. Reflection from a cube corner would affect beam width anyway. How are you wanting your laser rangefinder to operate?
It measures the reflection time and the corner reflector gives me a better range. It works fine.
 
  • #11
Suppaman said:
It measures the reflection time and the corner reflector gives me a better range. It works fine.
Great! Then why did you post this?
Suppaman said:
Summary:: How to calculate the distance in feet between the model and the camera that results in a one inch per pixel for the given parameters.

Please move to a better forum if available.

We have two friends discussing their photography efforts.

"you know that your photo of people with large one-inch square buttons on their coats will not look accurate," said Moe.

"Why is that," asked Curly.

Moe answered, "You have the model standing (feet?) from the 20 MegaPixel camera using the fifty-millimeter lens, and their buttons will show as one pixel in the image. You need to move the camera closer."

How to calculate the distance in feet between the model and the camera that results in a one inch per pixel for the given parameters. What is the formula?
 
  • #12
Suppaman said:
Just as an image from an orbiting camera has limits on the smallest object it can see, this is sort of the same question. I am looking for a way to tell how much detail will be available using a formula.
That's a very different question. No formula will tell you that. It's too nuanced.
Depends on the quality of your lens, the compression of your chosen file format, etc.
Suppaman said:
I do not think the pixels know how an image may be cropped. Assume the image is not cropped, same size as the sensor.
Of course it is assumed full image.

One of the problems is that 20MP camera will not tell you the format (ratio) of its sensor, so you can't know how big one pixel is. Some ratios are 3:2, some are 1:1.

berkeman said:
Great! Then why did you post this?

He's looking to figure out, via formula (i.e without leaving his armchair) how how far away he will need to be to get the subject's buttons larger than one pixel.
 
  • #13
DaveC426913 said:
how how away her will need to be to get the subject's buttons larger than one pixel.
With a laser rangefinder? I think I've fallen into the Twilight Zone...
 
  • #14
I want a formula to calculate the size of the image on the camera sensor. This tells me how much resolution an image will have, If I know something 100 feet away will require 1000 pixels to show a face I would have to use a longer lens or move closer if the formula said I would only cover 300 pixels.
 
  • #15
berkeman said:
With a laser rangefinder? I think I've fallen into the Twilight Zone...
Yeah, OK. So I guess OP is willing to rise from his/her armchair and seek empirical results.
 
  • #16
Suppaman said:
I want a formula to calculate the size of the image on the camera sensor. This tells me how much resolution an image will have, If I know something 100 feet away will require 1000 pixels to show a face I would have to use a longer lens or move closer if the formula said I would only cover 300 pixels.
Not a formula but an algorithm, which I did in post #2. Turning that algorithm into a formula is an exercise left up to the reader.
 
  • #17
I am in my late 70s with health issues and Covid is around, I do spend time in my chair writing SF managing my pills and stuff. I am a retired Senior Software Quality Assurance Engineer. Before I retired I was testing time of flight mass spectrometers. Science is one of my hobbies along with photography. I do appreciate your help, all of you.
 
  • #18
Suppaman said:
retired Senior Software Quality Assurance Engineer.
God the things you must have seen.
close-up-scream-painting.jpg
 
  • Haha
Likes Tom.G
  • #19
Suppaman said:
How to calculate the distance in feet between the model and the camera that results in a one inch per pixel for the given parameters. What is the formula?
It's a geometry problem, and one frequently dealt with by astrophotographers. I'm sure there are sites that will give the full derivation (if you google), but here's one with a rolled-up/simplified equation and a calculator:
https://astronomy.tools/calculators/ccd_suitability
 
  • #20
To find what you are after, the "Field Of View" (FOV) and the number of pixels across the sensor are needed.

NOTE: This applies for a fixed lens and sensor combination. If you change lenses or use a zoom lens, you have to re-calculate for each focal length.

  • The number of pixels across the sensor may be the hardest to find.
    • The camera manual or website may list the pixel count.
    • If you have a camera that attaches EXIF (Exchangeable Image File) information to the image data, you can use an image viewing program, or an EXIF viewing program, to read how many pixels wide and high the image is.
    • An image processing program, such as Photoshop, will also report the image size.
    • As a last resort, you can calculate pixel width if you know both the Aspect Ratio of the image and the total number of pixels in the sensor. Aspect Ratio is the proportion of the number of pixels horizontally to the number of pixels vertically. A common aspect ratio is 4:3; that is: if there are 4000 pixels horizontally, then there are 3000 pixels vertically, giving a 12MP sensor.
Now that you know the number of horizontal pixels (4000 in the above example), you need to
  • find the FOV.
    • Take a photo of something horizontal that you can measure the actual size of and fills the full width of the image.
    • Measure the Distance to what you photographed. (you will need this later)
    • The Resolution (smallest descernible feature) at that distance is:
      Resolution = [ (2 × <actual size of subject>) / (<number of horiz pixels)]
For different distances, the resolution scales directly with the Distance you measured above. If you move three times as far away from your subject, then the smallest resolvable detail will have to be three times as big.

Have Fun!

Cheers,
Tom

p.s. Sometimes lenses and/or cameras will state a FOV as an angle. This is the full extent in degrees from the left edge to the right edge of the subject that will be imaged. From that angle, using trigonometry, you can find the same information as calculated above, without having to measure distance or size of the object.

p.p.s. Please keep us updated on your results. Thanks.
 
Last edited:

FAQ: How to calculate size of objects in digital photo

How do I determine the size of an object in a digital photo?

To calculate the size of an object in a digital photo, you will need to know the resolution of the photo and the scale of the image. The resolution can be found in the photo's properties or by using a photo editing software. The scale can be determined by measuring a known object in the photo and converting it to the actual size. Then, you can use a simple formula: object size in photo = (object size in real life / scale) x resolution.

Can I use a ruler to measure the size of an object in a digital photo?

Yes, you can use a ruler to measure the size of an object in a digital photo. However, keep in mind that the ruler should be held at the same distance from the camera as the object in the photo. This will ensure accurate measurements.

What is the importance of knowing the size of objects in a digital photo?

Knowing the size of objects in a digital photo can be important for various reasons. It can help with accurate measurements for scientific research or analysis, determining the scale of a photo, or for creating accurate 3D models.

How do I measure the size of an object in a digital photo without a scale?

If you do not have a scale in the digital photo, you can still calculate the size of an object by using a reference object with a known size. For example, if there is a person in the photo and you know their height, you can use that as a reference to calculate the size of other objects in the photo.

Are there any online tools or software available to help with calculating the size of objects in a digital photo?

Yes, there are various online tools and software available that can help with calculating the size of objects in a digital photo. Some popular options include ImageJ, GIMP, and Photoshop. These tools have features specifically designed for measuring objects in photos and can provide accurate results.

Back
Top