DOF in Exif data

Have your say on issues related to using a DSLR camera.

Moderator: Moderators

Forum rules
Please ensure that you have a meaningful location included in your profile. Please refer to the FAQ for details of what "meaningful" is.

DOF in Exif data

Postby ATJ on Wed Jan 21, 2009 4:41 pm

I was scrolling through the Exif data for one of my images and I discovered that the camera (D300) records the depth of field which I thought would be quite useful. It also records the distance of the focal plane from the subject based on the focus information.

Here's the data from a group photo I took on the weekend with my 18-55mm lens:
Focus Distance : 2.66 m
Depth of Field : 5.45 m (1.64 - 7.09)

Quite useful I thought as it even tells you the front and the back of the sharp areas... that was until I looked at a macro shot at 1:1 with my 200mm lens at f/22:
Focus Distance : 0.50 m
Depth of Field : 0.00 m (0.50 - 0.50)

Um... a little more precision would have been helpful.

The Exif data does contain the hyperfocal distance which can be used with the focusing distance to determine distance to nearest and furthest points with acceptably sharp focus. For the same 1:1 image above:
Hyperfocal Distance : 90.77 m

According to my ILFORD Manual of Photography:

Distance to the nearest point of acceptable sharpness = (90.77 * 0.50)/(90.77+0.50) = 0.49726
Distance to the furthest point of acceptable sharpness = (90.77 * 0.50)/(90.77-0.50) = 0.50277

So the DOF is 5.51mm.
User avatar
ATJ
Senior Member
 
Posts: 3982
Joined: Fri Feb 18, 2005 10:44 am
Location: Blue Mountains, NSW

Re: DOF in Exif data

Postby colin_12 on Wed Jan 21, 2009 7:53 pm

Thanks for the calcs Andrew. They may come in handy.
Regards Colin
Cameras, lenses and a lust for life
User avatar
colin_12
Senior Member
 
Posts: 1853
Joined: Thu Jan 04, 2007 7:10 pm
Location: Hazelbrook

Re: DOF in Exif data

Postby Glen on Thu Jan 22, 2009 7:31 am

Thanks Andrew for letting me know about a feature I didn't realise was there
http://wolfeyes.com.au Tactical Torches - Tactical Flashlights Police torch rechargeable torch military torch police military HID surefire flashlight LED torch tactical torch rechargeable wolf eyes flashlight surefire torch wolf eyes tactical torchpolice torch
Thank You
User avatar
Glen
Moderator
 
Posts: 11819
Joined: Sat Aug 07, 2004 3:14 pm
Location: Sydney - Neutral Bay - Nikon

Re: DOF in Exif data

Postby ATJ on Thu Jan 22, 2009 8:46 am

Here's a batch file I created to extract the DOF data from the Exif:
Code: Select all
@echo %1
@c:\programs\exiftool-7.06\exiftool -Focallength -Fnumber -FocusDistance -DOF -HyperfocalDistance %1
@pause

This uses exiftool and would need to be modified depending on where you place the code for exiftool

I then associated the batch file with .NEF files and so all I have to do is right click on the .NEF file and select Open with... DOF.bat and it displays the data, e.g.
Code: Select all
"D:\alTables\NikonD300\200810\DSC_5098.NEF"
Focal Length                    : 60.0mm
F Number                        : 16.0
Focus Distance                  : 0.21 m
Depth of Field                  : 0.01 m (0.21 - 0.21)
Hyperfocal Distance             : 11.23 m


That provides enough information to determine the DOF with more precision. Note that it is still only an approximation.
User avatar
ATJ
Senior Member
 
Posts: 3982
Joined: Fri Feb 18, 2005 10:44 am
Location: Blue Mountains, NSW

Re: DOF in Exif data

Postby ATJ on Thu Jan 22, 2009 8:52 am

oh, and the formulae for determining the distances are as follows:

Distance to nearest point in acceptably sharp focus = (h * u)/(h + u)
Distance to farthest point in acceptably sharp focus = (h * u)/(h - u)

where h is Hyperfocal Distance and u is Focus Distance.

You can extend the formulae to:

Distance in front of focus = u - ((h * u)/(h + u))
Distance behind of focus = ((h * u)/(h + u)) - u
User avatar
ATJ
Senior Member
 
Posts: 3982
Joined: Fri Feb 18, 2005 10:44 am
Location: Blue Mountains, NSW

Re: DOF in Exif data

Postby gstark on Thu Jan 22, 2009 9:16 am

ATJ wrote:That provides enough information to determine the DOF with more precision. Note that it is still only an approximation.


And there you have it, folks: another dslrusers.com first - the world's first precision approximation! :mrgreen:
g.
Gary Stark
Nikon, Canon, Bronica .... stuff
The people who want English to be the official language of the United States are uncomfortable with their leaders being fluent in it - US Pres. Bartlet
User avatar
gstark
Site Admin
 
Posts: 22918
Joined: Thu Aug 05, 2004 11:41 pm
Location: Bondi, NSW

Re: DOF in Exif data

Postby ATJ on Thu Jan 22, 2009 10:05 am

gstark wrote:the world's first precision approximation! :mrgreen:

Precision says nothing about accuracy and so it makes perfect sense (mathematically) to have precision approximations and estimates.

And certainly not a world first: http://www.google.com.au/search?hl=en&q ... arch&meta=
User avatar
ATJ
Senior Member
 
Posts: 3982
Joined: Fri Feb 18, 2005 10:44 am
Location: Blue Mountains, NSW

Re: DOF in Exif data

Postby Mr Darcy on Thu Jan 22, 2009 10:46 am

Thanks Andrew you saved me from putting my Green Cardy on again. It's too hot for it at the moment :lol:
Greg
It's easy to be good... when there is nothing else to do
User avatar
Mr Darcy
Senior Member
 
Posts: 3414
Joined: Thu Oct 26, 2006 11:35 pm
Location: The somewhat singed and blackened Blue Mountains

Re: DOF in Exif data

Postby ATJ on Thu Jan 22, 2009 11:23 am

Mr Darcy wrote:Thanks Andrew you saved me from putting my Green Cardy on again.

You're welcome. I already had mine on for the DOF calculations.
User avatar
ATJ
Senior Member
 
Posts: 3982
Joined: Fri Feb 18, 2005 10:44 am
Location: Blue Mountains, NSW


Return to General Discussion