Depth of Field Calculation 
The Depth of Field derivation uses the Gaussian thin  lens equation familiar from
school science, where u is the object distance (camera to subject
distance), v is the image distance and f is the focal length of the lens. This simple geometric analysis provides an estimate of
the Depth of Field (the range of distances in object space that are
in acceptably sharp focus) for a real photographic lens.
SIMPLE CAMERA
REPRESENTATION
OBJECT SPACE
IMAGE SPACE Our
starting point is to calculate the far and near focus distances
(limits).
where the image distance is obtained from simple geometry (similar
triangles). Rearranging terms, the far focus distance becomes and the near focus distance becomes The depth of field (DOF) is the difference between the far and near focus distances combining terms and rearranging and the depth of field reduces to Now focus at the hyperfocal distance, then u = H and the far focus distance extends to infinity and the denominator
Solving
for
the hyperfocal distance
and since
on substituting for the diameter of the
camera lens, a = f/f/#,
where
f/#
is the
In terms of
the hyperfocal distance, the depth of field becomes
This formalism is particularly instructive,
depth of field is directly proportional to the circle of confusion, the square of
the focus (camera to subject) distance and the
Now
you can compare the depths of field for cameras with different image
formats (digital camera image sensors are different in size and
type). For the same field of view, (c/f) is independent of the image
format. From a set location (u is
constant), cameras at aperture settings (f/#)
that are directly proportional to their format sizes (or inversely
proportional to their focal length multipliers (FLM)) have the same
In
terms of H, the near and far focus distances, N and F, are given by
At focus distance (camera to subject distance) u = H/3, the front depth of field is half the rear depth of field. This is the often quoted '1/3 rule', the depth of field extends 1/3 in front and 2/3 behind the point of focus. For optimal sharpness everywhere, focus 1/3 or thereabouts into your scene. Apportionment of the front and rear depths of field is dependent on the focus distance (for a given focal length and f number): the rule is only precise at 1/3 hyperfocal distance. As the focus distance decreases, the total depth of field decreases and the front and rear depths of field (the front and rear depths of field are expressed as fractions of the hyperfocal distance) are evenly divided.
As the
camera to subject distance decreases (and the magnification increases),
One final
point, given N and F, the focus distance that positions the
depth of field
The
relationship is useful, provided
that you can measure the near (N) and far (F) focus
distances.

^{ }
^{ }