Approximate Focus Distance (AFD) in XMP Data

This post has an explanation of the ‘Approximate Focus Distance (AFD)’ which I’ve started displaying with the photographs. I’ve always thought I should be able to estimate the distance to my subject in a photograph based on the focal distance when the picture was taken. I researched this in the past and couldn’t find the equations or needed input data. Since then I’ve started using Adobe Lightroom, and I’ve also installed xdebug, which is a plug-in for Notepad++ for debugging PHP programs running on the server. With Lightroom I can download photographs directly to the Nextgen gallery on WordPress. With xdebug, I can see all the variables in the PHP Nextgen software.

I found a string called xmp_data, which has a field with the format: aux:ApproximateFocusDistance=”108/10″. “108/10” is an example for one photograph. I searched the web for a description of this, but couldn’t find anything. I think that XMP is an Adobe data format. I’m guessing that ApproximateFocusDistance gives the approximate distance to the subject as follows: Distance = 108/10 meters.

In some cases the first number is a huge integer, which I interpret as being equivalent to ‘Infinity’, which means the subject is too far away to measure the approximate focus distance.

I added software to my theme to extract this data and display it. It is displayed with the photographs using the acronym ‘AFD’. I noticed that it’s only included in photographs that I’ve downloaded from Lightroom, so I’m assuming that Lightroom is computing this and adding it to the metadata with the photograph. For this reason, only the more recent photographs since I started using Lightroom will have this information.

I don’t know yet if I can trust the data, since I had to guess at how to¬†interpret the string, and I don’t know how its computed. With the 100 – 400 mm lens and short distances it seems to be giving reasonable results, which makes be think that I interpreted the string correctly (e.g. correct units of meters, and dividing the two numbers). I’ve noticed that for longer distances there is quantization. I see results consistently at 99.4, 145.7, and 269, and nothing in between. This makes me think that the camera’s measurement of the focus is accurate enough for short distances, but not good enough for long distances. So, for long distances you only get a very rough ‘ballpark’ measurement of the distance. For example, say that the servo motors that adjust the focus could report position in units of 10mm, and the range is 200mm, so it gives 20 points separated by 10mm. Maybe the conversion to distance to the subject is prortional to the 10mm delta, so the ‘delta’ in the distance measurement is larger for larger distances. I’m making up the numbers but just trying to explain the concept. If I decide it’s worth the time and effort, I’ll make a histogram of the measurement results (i.e. write some software make the histogram).

This entry was posted in Photography, Web Development. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • Would you like to receive an email when a new post is added to this site? Click here.

One Comment

  1. Aaron Lester
    Posted February 12, 2013 at 11:29 pm | Permalink


    I need to see how this works ASAP…

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


  • Would you like to receive an email when a new post is added to this site? Click here.

  • Posts by Month

  • Categories

  • All Posts in Chronological Order: