# How to calculate meters per pixel for a given camera?

I am stuck on this problem for a while:

I have a square-shaped camera, with:

• 1000 pixels on vertical side
• 1000 pixels on horizontal side

I want to know the number of meters per pixel depending of the distance, I mean: If I have a 1 meter long object which is 100 meters far from the camera, how many pixels of the resulting picture will be occupied by the object?

I am not sure if it is useful, but we can estimate the length and size of the camera:

• 0.05 meters vertical
• 0.05 meters vertical

How to calculate the number of meters per pixel as defined above?

EDIT:

From first answers and the given formula, I am wondering:

• Does the formula depends of how far from the lens is the pixel device?

SECOND EDIT:

I have this data: The Optical Form Factor of the camera is: 1/2.5''

Is it related to the lens focal length? I did not find a definition on wikipedia and only this blog article that I don't understand

• Are you able and willing to do an experiment to determine the value? Jan 26, 2020 at 0:12

Independent of what you are imaging, the ratio of object dimension to it's image dimension is a function of the lens focal length and the distance to the object.

• Knowing the sensor dimensions allows you to determine if the image will "fit on the sensor".

• Knowing the sensor pixels per distance allows you to express the distance in pixels.

Image dimension / lens-focal-length = Object dimension / distance to object.

So eg a 1m long object at 100 metres from the lens, with a 200mm lens, will result in

ID / 0.2m = 1m / 100m or image dimension = 1 x 0.2 / 100 = 2 mm

If the sensor is a full frame "35mm" sensor of typically 24 x 35 mm size, in landscape mode, and the object is eg a 1m vertical fencepost, then the 2mm image will occupy 2/24th = 8.333%n of the sensor height.

If the sensor is a 4000 x 6000, 24 megapixel sensor then the image of the 1m fence[post will be 4000 pixels x 2/24 = 333 pixels tall on the sensor.
So 1 pixel is 1/333 of a meter at 100m at 200mm focal length = 3 mm at the object,
Which is awesomely impressive.

Each pixel on the sensor is 24mm / 4000 = 6 um.
Which is also awesomely impressive. In the image above, "Height" to base size is the same for both triangles.

So: Image-height / focal-length = Object height / distance to subject.
So Image-height = focal-length x Object height / distance to subject.**

Note:

Edited - I had a factor of 10 error initially.
I KNEW my 200mm lenses were not THAT good, so went back and found the error.

• Hi thanks for the answer, could you detail why it is "awesomeky impressive"? Did you mean that a 200 mm lens is someting very rare in camera? Jan 25, 2020 at 11:34
• @totalMongot I just meant that the idea of imaging 3mm resolution on something which the human eye sees as something fairly vague 'way over there' is an impressive feat of optics - which we regard as "everyday". || I have a number of lenses covering up to or beyond 200mm - i t's not overly rare. My "best" (and far from the best available) is a Sigma 70-200mm f/2.8. It is utterly superior to other smaller aperture (f/3.5, f/5.6, ...) that I have. It probably about matches the theoretical 3mm/pixel at 100 m described above. Jan 25, 2020 at 11:40
• Thanks I will use the answers and try to understand them, and come back to you Jan 25, 2020 at 11:43
• Thanks for the schema I edited the question: your calculation is valid for a pixel device which is "focal lens" far from the lens, isn't it? And if I increase the focal lens, I will get a larger picture of a distant object, but what will be the trade off? Jan 25, 2020 at 12:11
• @totalMongot The sensor (pixel device) is ALWAYS the focal length away from the lens optical centre when the object is in focus. You can operate the system out of focus - which means that the image is focused in some plane other than that of the sensor. To do so may be useful when you purposefully want a defocused image* but 99.999%+ of the time, you don't. ... Jan 25, 2020 at 23:09

# We don't know enough yet, but we're close

We can't determine the answer without knowing the magnification provided by the camera lens. What we need to know is how much your object fills up the sensor. Once we know how much of the sensor is taken up by the object, we can use simple ratios and division to determine the object-dimension-per pixel.

We can give you the calculations, though.

Let n be the percent of the sensor that the meter-long object takes up. We look at the display and in the simplest fashion measure what percent the object takes up (we will assume the display shows 100% of the sensor pixels). We could also use lens attributes, but it would be harder.

So the object takes up n% of the sensor, which means it takes up n x 1000 pixels.

Once we know how many pixels, we divide them into the length of your object and that will give us the object length per pixel. This would be the maximum resolution possible of the object. Actual resolution would be affected by the fidelity of the camera lens.

• Thanks for the answer! It is indeed a good experimental way, but I am more interested in a theoretical way using the datasheet of the camera/photo device Jan 25, 2020 at 12:09