4

I am trying to get the precise focal length used for a stack of photographs taken with various focal length. See the following link.

My problem is that even if the photographs are obviously focusing on different part of the image, the focal length given in the metadata is always the same. Is there a way to have precise information on this?

(For those interested: I am trying to build a depth map from a stack of photographs. To do that, I need to get the precise focal length used. I am no professional photographer, still I'm getting more and more interested with those things...)

EDIT : I may need to be more precise. If you download the rifle focus stack, you will have 24 shots focused on 24 different parts of the image. Still, the focal length you can read in the metadata is always 9.7mm.

4

I'm not absolutely sure of what you're asking, but I'll try to answer.

The focal length is not a measure of at which distance the lens system has been focused but rather a measure of how strongly the system converges or diverges light. In photography this translates to how wide the lens is and what field of view you'll get by using it.

When you change the focus of a lens the focal lens stays (ideally) the same. In practice (such as lenses with internal focusing) the focal length does change depending on where you focus, but this is just a minor drift and doesn't even have to appear in the metadata depending on the model of the lens/camera. The phenomenon is called breathing or focus breathing and can be a problem for videographers trying to do racking focus, but is usually not a problem for still photographers. Focus stacking could be an exception to this.

All in all there's nothing surprising or strange that the focal length stays the same no matter where you're focusing. Depending on the camera it's sometimes possible to get additional information such as what focus point(s) were used during the exposure or the depth at which the focus was locked. I recommend you shooting in RAW and to use the bundled software from the camera maker in order to have the best possibilities to extract the information you want.

  • Thanks a lot for your answer. If I try to be clear : the relation between the focal length f', the distance between the object and the lens OA, and the distance between the lens and the image OA' is 1/f' = 1/OA' - 1/OA When I look at the metadata, I read "focal length : 9.7mm". It must be f'. The information I want is the distance between the lens and the CCD, that is to say OA'. If I have it, I will know that the part of the image that is in focus is at the distance OA (easy to calculate). – Antoine M. May 9 '14 at 9:54
  • Moreover, one thing isn't clear to me. If I change the focal length of my camera in manual mode for instance, I will change the position of the lenses in the camera, which will result in a different focal length of the lens combination. If I change the focus then, what do I change ? The position of the entire lens block with respect to the sensor ? (I may be entirely wrong, I don't know) – Antoine M. May 9 '14 at 9:58
  • @AntoineM. Regarding your physical relation "1/f' = 1/OA' - 1/OA" I'm not sure why you put a negative sign in front of 1/OA. The usual representation of the thin lens formula is 1/f = 1/S1 + 1/S2, where S1 and S2 are distances from the object to the lens and from the lens to the image respectively. Regardless you rarely get these variables stated in the metadata but rather calculated values (derived from them) that are more useful to the photographer. I can't say what info you can get since it differs between models and makes, but try for yourself and see what values you get. – Hugo May 9 '14 at 10:13
  • In fact it is just that I am using distances and not lengths, so for a photograph OA is negative. What do you mean by "calculated values derived from them" ? – Antoine M. May 9 '14 at 10:22
  • 1
    @AntoineM. The answer to what happens inside the lens when you focus compared to when changing the focal distance (zooming) it is well beyoud the scope of this question but I'll happily direct you to another question about that found here photo.stackexchange.com/questions/18807/…. If that question does not cover what you want to know feel free to ask a new question (after searching and confirming it hasn't already been answered) and I'll try to answer that. – Hugo May 9 '14 at 10:22
2

As others have mentioned, the focal length EXIF tag isn't what you need, what you want is a non-standard EXIF tag called "Distance to Subject" or "Subject Distance". This tag doesn't seem to be supported by your camera.

Unfortunately, even with a camera that does support that tag, I don't know that the results would be useful to you. The reason some cameras record a distance to subject is to make program mode exposure compensations, especially with flash photography (the closer the subject, the camera needs less flash power or a smaller the f-stop). To do that you don't need milimeter accuracy, in fact you probably don't need sub-foot accuracy.

I've never experimented with that tag, I don't even know if my camera records it, but a quick look on the Internet seems to back up my guess. Googling for "accuracy of distance to subject exif data" shows that a lot of people don't think it is accurate, and may be based on focus zones (so everything that is 1.0m to 2.0m away gets reported as 1.5m).

There might be specialized equipment out there, but my impression is that general purpose cameras aren't going to do what you want.

  • Thank you for your answer. I didn't know this tag, but I think I can explain why it is not used. The thin lens formula enables us to know the distance to the object if we know the distance between the lens and the image. Still, as there is a finite aperture, the depth of field is not null, and so this method is really imprecise. I have a question for photographers : when you choose the biggest aperture you have (f/1, f/2), and you choose manual focus, do you change focus with much more amplitude ? My problem is I have a constant aperture on my camera, this time it doesn't help... – Antoine M. May 9 '14 at 16:38
0

You will not get the exact focus information from metadata. However, why don't you put a simple ruler there, just out of your main view field of interest? Later you just crop the pictures the same way, and you will have the stack and also the exact focal length.

  • The problem is I want to automate the process. The goal is to write a script that, with a stack of focused photographs, gives the depth map of the scene. If there is really no way to get the exact focus information then it is hopeless, unless I change the camera's OS itself. – Antoine M. May 9 '14 at 10:42
  • 1
    This could be very easily automated. You put a fine ruler there, and a script locates the sharpest position. You should use a Gray-code ruler (the same that is being used in linear encoders, giving the exact linear position) along with the fine hairlines (to get the sharpness info), and that's all. – TFuto May 9 '14 at 10:44
  • I may not understand. When you say "put a ruler", are you speaking of the real world ? – Antoine M. May 9 '14 at 10:48
  • Yes, a physical ruler. – TFuto May 9 '14 at 10:48
  • Sorry for the late answer, I got a phone call. Well, I can't use a physical ruler, because my final goal is to make this script work with any photographs stack. I guess I have to check if there is no particular camera giving detailed information on focus. Ever heard of that ? – Antoine M. May 9 '14 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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