DOF calculation is significantly different from other tools

Started by Somersetman, March 09, 2015, 12:18:19 PM

Previous topic - Next topic

Somersetman

I'm not sure this is a bug, so please forgive this newbie if I've posted in the wrong section  :)

I'm using Jeffrey Friedl's EXIF viewer (http://regex.info/exif.cgi) which I understand is built on ExifTool.  For a particular image of mine (link below) I see the following data extracted from the EXIF:

Camera:    Canon EOS 5D Mark III
Lens:    EF24-70mm f/2.8L USM Shot at 70 mm
Exposure: Auto exposure, Aperture-priority AE, 1/40 sec, f/3.2
Focus:    At 81cm, with a depth of field of about 6mm, centered on the focus point

The calculated depth of field (DOF) is very different from that derived by (for example) http://www.dofmaster.com/dofjs.html which uses the circle of confusion method to calculate a DOF of approx 2cm, based on the same inputs (Canon EOS 5D Mark III,70mm, f/3.2, 81cm).

Looking at a number of images, I notice that ExifTool seems much more pessimistic about the depth of field (possibly excessively so, judging the image by eye) and I wonder if anyone can suggest why this should be?

[For interest the image I used in this example was: http://d2bfgqadt6qjww.cloudfront.net/i/p/250/25024-414114175.jpg?1418238073 which doesn't show as much deviation between the tools as others I've looked at, but is conveniently available and suitable for work!]

Phil Harvey

The calculation of the circle of confusion is somewhat subjective.  ExifTool uses D/1440, but some other utilities use D/1750 or something else.  You can change this to whatever you want by overriding the CircleOfConfusion tag in an ExifTool config file.  The sample config file shows an example to do exactly this (search for CircleOfConfusion on that page).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Somersetman

Thank you for the speedy reply Phil - I understand a little more now. However, I'm still a little confused:

I plug the numbers from my example (and the Canon 5D III's sensor diagonal size of 43.3mm, divided by 1440) into the formula you gave in this answer: http://stackoverflow.com/questions/1443829/how-to-know-or-calculate-depth-of-field-of-a-photo-from-exif-tags and I come up with a DOF of 24mm.

This is consistent with DOF Master et al, but at odds with ExifTool (or at least Jeffrey Friedl's interpretation of its output) which says DOF for the image is 6mm

- Greg

Somersetman

Update: Of course Jeffrey Friedl may be over-riding the 1440 constant in his use of ExifTool, but I can't get the DOF to come out at 6mm for any sensible value of the constant  :)

Phil Harvey

I took a look at your example.  This image has been resized.  See the Notes for CircleOfConfusion in the Composite tags documentation.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Somersetman

You're quite right (and sorry I didn't get to check out those notes before my original query). When I point Jeffrey Freidl's tool to the original image the DOF is shown as 2.3cm, as expected...

But I still don't understand why re-sizing the image should matter, as the numbers on which the DOF calculation depends (focal length, subject distance, aperture etc) are the same in the EXIF data for both the original and the re-sized image.

- Greg

Phil Harvey

Hi Greg,

The problem is calculating the focal plane size (the "D" in D/1440).  This is calculated from the FocalPlaneResolution tags and the image pixel size.  The FocalPlaneResolution tags should really be scaled if the image is resized, but I know of no image editor that does this.

Alternatively, it may be calculated from FocalLength and FocalLengthIn35mmFormat, but only if both tags are written to the image.  You can probably add FocalLengthIn35mmFormat to your image to fix this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Somersetman

That does completely explain what I see. Tools such as DOF master just get the focal plane size from a look up table of cameras I believe, whereas ExifTool quite rightly tries to be more generic than this.

Thank you once again for your time in explaining this - and for sharing ExifTool with the world!

Regards,

Greg