Question

I want to know the depth of field of a photo, preferably in cm or m.

I know that we can know the camera setting by reading the EXIF tags, but is there a tag directly telling us the depth of field? Or how can we calculate it from some EXIF tags?

Examples would be appreciated. Thanks!

Was it helpful?

Solution

Calculating depth of field:

t = A * (S/1440) * (D - F) / F^2

The near focus distance = D/(1+t)

The far focus distance = D/(1-t)

And the full depth of field is the difference between these.

The variables are:

A = lens aperture (F Number)

S = camera sensor or film plane diagonal size in mm

D = focus distance in mm

F = lens focal length in mm

Of course, the sharpness of focus is subjective, and is adjusted by changing the constant in the calculation of the circle of confusion (CoC). Here, I have used CoC = S/1440 which is a value that is commonly used.

OTHER TIPS

I'm guessing here, so I'd appreciate if anyone else can confirm this:

I believe you cannot programatically determine the depth of field from the available EXIF data - you must know the f-stop, focal length, and this is crucial: the subject distance.

The fields FNumber and Focal Length will give you the first two. The third would not normally be possible to determine with the camera. You would need some mechanism for ranging - some extra equipment for the camera or some known values for triangulation.

This web page http://www.dofmaster.com/dofjs.html has a straightforward explanation of what is involved in depth of field calculations:

I came across the above formulae while looking for dof calculations and found these.

Just a couple of points:

  1. The values of t need to be checked in the program. If t = 1, then the focal distances are D/2 and infinity in which case D is actually the hyperfocal distance (hfd). This is easily proved and gives the hfd as (f**2)/(coc*Fnumber) approximately.

  2. If t is greater than 1 your answers will be negative and this is a meaningless result

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top