DIY: an optical meter

A simple method for measuring the size of what you photograph underwater.
Expand here for a description

An idea worth sharing if you are looking for measuring the size of your macro subjects without dropping a reference object in the scene.

Picture EXIF metadata include a field called "Focus distance 2" which expresses the distance to the subject in focus.

By taking a few pictures to a ruler in a bucket with water, at different distances, you can then fill a table with the relationship between the distance as measured in the EXIF data and the number of pixels per mm of the ruler.

Once that you have that relation, which is a binomial curve, all you have to do is:

  1. pick one of the pictures with your subject in

  2. measure the size of the subject in pixels (A)

  3. get the distance in the metadata field Focus Distance 2

  4. look at your table to find the corresponding pixel/mm value (B)

  5. divide A/B et voila' you have the size in mm.

For reading the EXIF "Focus distance 2" data I used Exiftool ( as other products such as Adobe do not show this field.

Things to keep in mind:

  • Each combination of camera and lens has a different curve, you need to built your own, it takes a couple of hours taking pictures in the bucket and then analysing the images but once done it's there. The more pictures at different distances the better. I have taken 30 between 9 and 40 cm of distance, but even with 10 pictures in the same distance range the result is very close.
    I then went in seawater and repeated the experiment, which confirmed the correlation I made using the bucket, with a general shift of a few % points, good reminder that due to different refraction index, seawater is 3% off compared to tap water.

  • The measured distance, based on the position of the focus ring, quickly loses precision the further away is the subject, that's intuitive if you look at the logarithmic focus scale of a lens. With the above tests you can push the envelope e determine the max distance at which data are consistent before the curve starts taking unpredictable directions at random. With my Sony A-6500 with a Sony 30 mm macro lens in a Fantasea Housing I am confident the method is precise at a distance of up to 40 cm. I can't test further away as my bucket is only 40 cm deep, but it could have been done in a pool.

Talking about tolerance: my camera Sony A-6500 stores distance with a resolution of 1 cm. The effect is that the camera could be 10.9 cm away and still showing 10, that's why it's worth reminding that the error with my camera can be up to +-5% at the closest range, then it becomes half of that at 20 cm. Other cameras may provide distance in smaller units and be more precise, I haven't had the chance to do tests but will update it here if I get to know.

As matter of fact, tests performed in the sea using the table created using the bucket, plus some minor tuning to smooth the curve have resulted in a margin of error of +-4%.

  • One interesting thing I noticed, is that the distance values in EXIF are loosely related to the physical distance sensor-to-subject, probably due to the way the lens measure it using its mechanics/electronics. You may find that they say 10 cm at 10 cm but then 20 cm at 15 cm and so on, but it does not matter at all as we don't refer to physical distance anywhere in this method.

Sub-millimetre measurements are possible with a macro lens

For a bit of geeky fun, I estimated the number of eggs this gobbleguts is carrying in the mouth

Blenny's eggs, at different stage of development, eyes can be seen


Set-up for taking pictures and acquiring the reference data at different distances from the ruler

By counting the number of pixels per mm. we obtain a dot in the reference curve

This is the reference curve that is obtained with 40 pictures at different distances (9 - 92 cm) for my Sony SEL30M35 macro lens..

Once you have this curve you can directly relate the EXIF distance to the pixels/mm and knowing the number of pixels a subject have you can obtain the size of the subject in minutes.