Alley in Pisa, Italy

by Lars Kotthoff

submit your photo


Hall of Fame
View past winners from this year

Please participate in Meta
and help us grow.

Take the 2-minute tour ×
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It's 100% free, no registration required.

From Matt Grum's comment to my previous question, I learned that manufacturers may casually "round" actual focal length of a lens to some nice number that gets printed on the box and stored into EXIF. From his answer to the same question, it seems I would need to know actual focal length of a lens to test what aperture is used.

I have also heard that most lens will change focal length when focused very close.

How would I go about testing what focal length my lens is actually using when focused on a given distance? EXIF obviously won't help me here, because data is put there by manufacturer.

share|improve this question
1  
Yes, focal-length changes with focus distance. Not only for close focusing, it is just easier to notice there. Normally manufacturers quote focal length when focused to infinity. Yes, most manufacturers round the number to a whole millimeters, except for Tokina and Olympus which round to a ½ millimeters. Sigma has one lens with half-millimeter focal-length. –  Itai Jun 29 '11 at 21:13
    
@Itai Nikon also has 10.5mm fisheye –  Imre Jun 29 '11 at 21:36
3  
It makes a more difference at wide angle than for long lenses. The difference beteen 10 and 10.5 is the same as the difference between 200 and 210. –  mattdm Jun 29 '11 at 21:43
2  
1  
For an example of how far out lenses can be look for comparison shots between the Canon 100mm f/2.8 macro and the Canon 100mm f/2.8L IS macro - despite both being sold as "100mm" their focal lengths are noticeably different! –  Matt Grum Jun 29 '11 at 23:14
show 7 more comments

4 Answers 4

up vote 11 down vote accepted
+25

There is a mathematical / measurement method to calculate the effective focal length of a lens by measuring its angle of view.

The formula for angle of view is given as
enter image description here

To calculate effective focal length (f), the formula comes down to:
f = d / (2 * tan(α/2)) -> Equation1

Where d represents the size of the sensor in the direction measured. d would be 24 in case you are using a full frame camera.

Let us now have the following setup for measuring α

enter image description here

You have a camera sitting at a height H from the ground and a distance of X from the wall with a scale. Now take a picture and you should be able to read the maximum height the lens can see (this would be H + Y).
Now knowing X and Y, we can calculate half the angle of view (i.e. α/2) using this link (X would be the opposite side and Y the adjacent side)

Now that you have figured out α/2, use it on Equation1 to calculate the effective focal length of the lens.

The value is only accurate as your measurements.

Edit 1:
In reference to mattdm’s question: Are the manufacturer-stated sensor dimensions close enough?
With reference to sensor sizes of camera’s in these links: here and here
We can logically assume that camera makers or at least Canon and Nikon round their sensor sizes 1/10 of an mm. i.e. there is a possibility of +/- 0.05mm error in case they round the sensor size.
Let us consider 3 type of lenses:
1. Wide angle lens (say 13mm, angle of view: 85.4)
2. Normal lens (50mm, angle of view 27.0)
3. Telephoto lens (300mm, angle of view: 4.58)

The effect of a 0.05mm change in sensor size are:
change for wide Angle lens = 0.05 / (2 * tan(85.4/2)) = 0.04613 mm appx.
Which represents an difference of 0.35% (i.e. (0.04613 / 13) * 100 )

change for normal lens= 0.05 / (2 * tan(27/2)) = 0.012 mm appx.
Which represents an difference of 0.024% (i.e. (0.012/ 50) * 100 )

change for telephoto lens= 0.05 / (2 * tan(4.58/2)) = 0.0019 mm appx.
Which represents an difference of 0.0006% (i.e. (0.0019/ 300) * 100 )

We can thus see that with a 13mm wide angle lens and taking a 0.05mm error in manufacturers’ measurement, the change in the focal length is only 0.35%.

I hope that my math is correct.

Edit 2:
In reference to Imre's question about measurements for X & H,
H should be measured from ground to the horizontal center of the sensor.
X is the distance between sensor and the wall.

share|improve this answer
    
This seems perfect if one wants to calculate the focal length mainly out of interest in the angle of view. But @Imre mentions wanting to know for purposes of calculating real aperture. This means that it's vital to know the precise dimensions of the part of the sensor used for imaging. How does one find that? Are the manufacturer-stated sensor dimensions close enough? –  mattdm Feb 21 '12 at 14:40
    
Edited my answer for your question. –  Vivek Feb 22 '12 at 2:31
    
I guess H should be measured from ground to the horizontal center of lens. Which point on the camera/lens does the X refer to? –  Imre Feb 23 '12 at 6:59
    
Updated my answer for your question Imre. –  Vivek Feb 23 '12 at 19:33
add comment

Assuming a standard lens, standard camera, i.e. the setup can be modelled as a pin-hole camera. This doesn't work with tilt/shift, and maybe not with wide-angle lenses (if you want to know about those, we could work it out).

In computer vision, often the intrinsic properties of cameras are calculated. Intrinsic because they refer to settings of the camera within the camera. Extrinsic properties are orientation and position. Intrinsic properties are several, among them the magnification. My solution is:

  • Use a standard tool from Computer Vision (CV) to calibrate the camera and lens at the given settings.
  • Look up the pixel size for your camera.
  • Ask someone else to convert magnification to focal length. (I don't know yet how this works)

Calibration

Calibrating in CV is mostly done using a chess board pattern. You take several (~10) photos of that pattern from various positions and distances. The algorithm works then in the following way:

Pretend that you know the position of each vertice on the board, find a set of parameters to the camera model that best explain seeing all the points on the board in the images.

In theory I would recommend OpenCV for this, it has an example code for that. But this is maybe not too practical (you'll need to install OpenCV for this, and possibly change a bit of code.). There are probably other solutions out there that do this.

Calculating focal length

The result of the calibration step is the K matrix (called the intrinsic matrix). It maps 3-space points in the camera's coordinate system to homogeneous 2-space points on the image plane.

$     \alpha 0      p_x
 K =  0      \alpha p_y
      0      0      1 $ (Multiple View Geometry, p. 157, 2nd Ed, 2003, Hartley & Zisserman)

We only care about \alpha here. p_x is about half the sensor width in pixel, similarly for p_y, it relates to where the principal ray intersects the image plane. Interestingly my cheap phone camera violates that much more than a good DSLR, or even an expensive webcam, or an Iphone 4 camera.

\alpha is then related to the focal length. \alpha = f m. m is the number of pixels per unit distance in image coordinates. f is the focal length. But note: this is in the pinhole camera model, so the distance between image plane and pin-hole of the camera. I am not sure how to find the focal length photographers think of to it.

Alternative

Someone posted a link about a different approach: http://www.bobatkins.com/photography/technical/measuring_focal_length.html Down at "The Easy Way" in the article a different method is proposed. Given two stars, look up the positions of the stars and calculate the angle between them. Then see how your camera setup measures that angle. Read the link for a complete run-through.

The downside of that is that it won't work with any focal distance but only focus at infinity. On the other hand, my approach won't work at infinity. Or treat 500m as infinity, buy a corn field and mow a chess board pattern into it, rent plane and take photos from 500m up...

share|improve this answer
    
You might find some useful details on magnification and focal length here: pierretoscani.com/echo_focal_length.html#FocalLength04 If that does not help, you might look for a formula to convert focal length to magnification, and invert the formula and run a magnification through it (although most such formulas I've found with some quick searches are REALLY rough, and often based on the inaccurate anectode that a 50mm lens is "normal" for 35mm film, which is not actually the case (See the comments for details).) –  jrista Feb 17 '12 at 21:56
add comment

Calculate the magnification M of the lens using the object and image size. With M and the object distance the focal length of the lens may be calculated.

share|improve this answer
    
Assuming it's been twenty years size my high-school geometry class, how would I go about doing that? –  mattdm Jul 2 '11 at 22:56
    
As an example. I image a two meter (S_o) stick which is 10 meters (d_o) from the camera. From the image the two meter stick is 1000 pixels wide. Each pixel is 10 micro meters giving a image size of 0.01 meters (S_i). The magnification is M = S_i/S_o = 0.01 / 2 = 0.005. I think M = f / (f-d_o), you might want to confirm with an optics book. The focal length f can be calculated. –  JMD Jul 2 '11 at 23:15
    
I just tested a canon lens set to f=55 mm, and the measured focal length was 52 mm +/- 0.75 mm. –  JMD Jul 2 '11 at 23:35
1  
JMD, welcome to the community. you may want to move your comments to the body of the answer itself. –  ysap Jul 3 '11 at 7:09
    
This only works if the object is far away. Otherwise you need to take into account the distance between the two principal points of the lens. Most of the time you do not know what this distance is. –  Edgar Bonet Jul 3 '11 at 13:35
add comment

I looked at Bob Atkins' "Easy method", but it leaves you to work some astro data out.

My version of his method provides all the astro how-to info and links, with step-by-step instructions, and should be significantly easier for novices to implement.

http://www.pentaxforums.com/forums/pentax-lens-articles/169225-using-2-stars-determine-actual-focal-length-lens-distance.html

share|improve this answer
    
Hi, and welcome to Stack Exchange. Would you mind posting at least a summary of your method here? Pentax Forums has, at least once in the past, changed something so that all incoming links were broken. –  mattdm Mar 2 '13 at 14:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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