# Calculate object size when I have physical pixel size

How do I calculate the object size when I have

• focal length = 25mm
• distance to object = 700mm
• CCDs pixel size = 4,4µm ?

My camera is this one. Appreciated!

Edit: Could this work:

real height = (object px height * pixel size * distance)/(focal length) ?

-
What is the width of the sensor in mm? – ElendilTheTall May 23 '12 at 10:42
I actually don't know for sure, but I found on this website "in the case of the 1/1.8" tube the image area was 7.176mm x 5.329mm" – chwi May 23 '12 at 10:44
This is quite similar to another question which I answered. – Håkon K. Olafsen May 23 '12 at 11:33
This is a related question, but not the same in terms of what is known and what is being calculated. – Michael Clark Jul 5 '13 at 12:09

There are several problems with your solution - real world problems that will seriously impact the accuracy of your calculation.

The first is that this will only work if the object you are measuring is exactly parallel to the camera sensor (or you'll have perspective distortion).

The second is that focal lengths are not accurate, the number in the spec is rounded to the nearest common focal length and even that only when the lens is focused to infinity (focal length changes with focus).

And that's even before we consider distortion caused by the lens and other imperfections of real world optical devices.

Most of the problems can be solved by taking a test shot of an object with a known size

-
Thank you, very descriptive! The problem is that my teacher is a dick, and won't accept these facts, telling us only to ignore such data as you describe. Thank you tho, will mention it! – chwi May 23 '12 at 14:14
Pixel pitch is the distance from the center of one pixel to the next, so specifications expressed as pixel pitch include the gaps between pixel wells. For example, the Canon 5DII does not use a "gapless" sensor. But the 5634 horizontal resolution multiplied by the 6.39µm pixel pitch yields 36mm which is the physical with of the sensor. (5634 x 0.00639mm = 36.0126mm. The extra .0126mm figures out to less than 0.00022365 microns or 0.0000022365mm per gap, which means it is an error caused by rounding the pixel pitch to only three significant digits.) – Michael Clark Jul 5 '13 at 11:36
@Wilhelmsen Your teacher is asking you to calculate something and is giving you data to work with to solve a problem. He may be a dick; but, the question is very reasonable and the calculation of the answer has little to do with extraneous "red herring." This answer is not good advice for a novice who must be able to grasp fundamental principles of simple lens formulas. – Stan Sep 3 '13 at 4:33

Quick mental examination says your formula looks correct.

Almost intuitively:

• Image_height x (Distance/Focal_length) = Real height

so

• (Pixel_pitch x pixels) x (Distance/Focal_length) = Real Height

-

To determine the size of an object in image you need to know the field of view. There are numerous calculators online, like this one.

According to this Wikipedia article the crop factor of a 1/1.8" sensor is 4.84. Putting that information, along with the focal length and subject distance information you've supplied, into the FoV calculator gives field of view measurements of:

Width - 208.26mm

Height - 138.84mm

You can now measure the object on the photo and calculate the physical size by calculating the percentage of the image it fills, e.g. if the object takes up 50% of the width of the image, it is 104.13mm wide in 'real life'.

-
Beware that you can't trust specifications here, at least if you want more than ballpark accuracy. The actual size of any given 1/1.8"-class sensor may vary, and lens focal length is often rounded or just plain given with poor accuracy and precision. – mattdm May 23 '12 at 11:37
I am not supposed to use online calculators for this, since I need to be able to calculate using only these sizes by hand. – chwi May 23 '12 at 11:38
@Wilhelmsen The site gives you all the formulas for calculating by hand. – ElendilTheTall May 23 '12 at 11:46
@ElendilTheTall The way you discuss will get an answer that is as accurate as the initial data is (as discussed by mattdm), but using trigonometry to solve this problem is not necessary. Simple ratios between the height of the image on the sensor and the height of the object itself is much easier and just as accurate. – Michael Clark Jul 5 '13 at 11:39