Search code examples
formulaphotoexifphotographyphotogrammetry

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


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!


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.