3
\$\begingroup\$

How do I calculate the object size when I have

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

My camera is this USB 1/1.8" CCD C-mount camera.

Edit: Could this work?

$$ \text{real height [mm]} = \frac{\text{object height [px]}\times \text{pixel size }\left[\mathrm{mm\over px}\right]\times \text{distance [mm]}}{\text{focal length [mm]}} $$

\$\endgroup\$
4
  • 1
    \$\begingroup\$ This is quite similar to another question which I answered. \$\endgroup\$ May 23, 2012 at 11:33
  • \$\begingroup\$ This is a related question, but not the same in terms of what is known and what is being calculated. \$\endgroup\$
    – Michael C
    Jul 5, 2013 at 12:09
  • \$\begingroup\$ Possible duplicate of Can we measure size of an object using EXIF data from a photo? \$\endgroup\$
    – mattdm
    Mar 6, 2019 at 20:53
  • 1
    \$\begingroup\$ vtc b/c Uses camera as measuring device, not to take pictures. \$\endgroup\$
    – xiota
    Mar 8, 2019 at 9:06

3 Answers 3

4
\$\begingroup\$

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

\$\endgroup\$
5
  • \$\begingroup\$ 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! \$\endgroup\$
    – chwi
    May 23, 2012 at 14:14
  • \$\begingroup\$ 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.) \$\endgroup\$
    – Michael C
    Jul 5, 2013 at 11:36
  • 2
    \$\begingroup\$ @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. \$\endgroup\$
    – Stan
    Sep 3, 2013 at 4:33
  • \$\begingroup\$ It's a shame that neither Nir nor chwi have visited for some years. Nir's answer is exceptionally bad advice in the circumstances, and chwi's already poor assessment of an ideal case learning opportunity was clearly further worsened by the poor answer. \$\endgroup\$ Jan 5 at 1:23
  • \$\begingroup\$ 11 years on this very poor accepted answer has one of my exceptionally rare downvotes. \$\endgroup\$ Jan 5 at 1:24
3
\$\begingroup\$

Quick mental examination says your formula looks correct.

Almost intuitively:

$$ \text{real height} = \text{image height}\times{\text{distance}\over \text{focal length}} $$

so

$$ \text{real height} = \text{pixel pitch }\times\text{pixels}\times{\text{distance}\over \text{focal length}} $$

\$\endgroup\$
0
\$\begingroup\$

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'.

\$\endgroup\$
4
  • 2
    \$\begingroup\$ 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. \$\endgroup\$
    – mattdm
    May 23, 2012 at 11:37
  • \$\begingroup\$ I am not supposed to use online calculators for this, since I need to be able to calculate using only these sizes by hand. \$\endgroup\$
    – chwi
    May 23, 2012 at 11:38
  • \$\begingroup\$ @Wilhelmsen The site gives you all the formulas for calculating by hand. \$\endgroup\$ May 23, 2012 at 11:46
  • \$\begingroup\$ @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. \$\endgroup\$
    – Michael C
    Jul 5, 2013 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.