How to know or calculate depth of field of a photo from EXIF tags?

Andy Li picture Andy Li · Sep 18, 2009 · Viewed 11.6k times · Source

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!

Answer

Phil Harvey picture Phil Harvey · Sep 22, 2009

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.