30: My derivation of the hyperfocal distance

March 30th, 2010
While this has nothing to do with macro photography, thinking about the hyperfocal distance gave me a lot of insight into the workings of DOF. The hyperfocal distance is the distance from the camera where if you focus you lens on that point, everything behind that point will be in focus – i.e. the depth of field behind that focus plane goes to infinity.

Hyperfocal distance can be understood in the same way as macro depth of field, mainly a factor of the size of the object circle of confusion vs. the entrance pupil of the lens and the angles that they make with each other. In order for the triangle that defines the rear DOF to have an infinite baseline, the angle that the entrance pupil makes with the c(o) needs to be 90 degrees or more (angle a in the diagram) - the triangle ceases to be a triangle. This can be accomplished in two ways: 1) The entrance pupil and the c(o) are the same size, 2) The entrance pupil is smaller than the c(o).

The top shows a finite back DOF, the bottom an infinite back DOF

The minimum fous distance where the rear DOF goes to infinity is the hyperfocal distance and that is where the entrance pupil and the c(o) are equal.

En = c(o)             (En = entrance pupil in mm, c(o) = object circle of confusion)

That can be expanded a bit as the:

c(o) = c/m           (c = circle of confusion, m = magnification)

En = f/N              (f = focal length, N = aperture setting)

Substituting the above factors gives you:

f/N = c/m

or:

m = c*N/f

That defines the magnification where the hyperfocal situation is achieved. To get the distance, m needs to be converted into a distance.

d = f*((1/m) + 1)

Substituting the previous equation for m we get:

d = f*((1/(c*N/f)) + 1)

d = f*((f/c*N) + 1)

d = (f^2/N*c) + f

Hyperfocal distance is generally written as H

H = (f^2/N*c) + f

Since the c(o) and En are the same size, the front DOF should be equal to half of the focus distance.

29: My own derivation of the macro DOF equation

March 18th, 2010
I was recently looking at a depth of field diagram like the one in the last post and decided that I wanted to figure out the macro DOF equation in my own way. I know that the typical macro DOF equation is a simplification and approximation of the real DOF equation that is much more complicated. So I went about looking at the diagram to see how it can be simplified.

The simplification that I saw was that with a sufficiently small DOF, the angle that the edge of the exit pupil makes with an oject at the front of the DOF is very nearly the same as it makes with an object at the back of the DOF (diagram below: angle a is very nearly the same as angle b). Since these angles are very close to the same, I can make the assumption that they are the same. That means that the triangles made by the rays going through the edge of the object circle of confusion, c(o), from the front and the back are the same (diagram: triangle C is the very nearly the same as triangle D).  This assumption means that I can just worry about the amount of DOF on the back side of the focus plane and multiply it b 2.

The c(o) is very small and the entrance pupil is very large (not shown)

This leads to a simplification where you can calculate the DOF using similar triangles:

This is not to proportion, the c(o) should be much smaller.

DOF = 2*D

Given the similar triangles:

A/B =C/D

D = C*B/A

DOF = 2*C*B/A

A = En/2 = f/2N       (where En = entrance pupil, f = focal length, N = aperture setting)

B = c(o)/2 = c/2*m           (where c(o) = object circle of confusion, c = circle of confusion, m = mangification).

C is very nearly equal to the focus distance since the DOF is quite small and this equation only applies to higher magnifications.

C = f*((1/m)+(1/P))            (where f = focal length, m = magnification, P = pupillary magnification)

All these can be put into the original equation an you get:

DOF = 2 * (c/2m) * f *(1/m + 1/P)/(f/2*N)

DOF = 2*c*N*f*(1/m + 1/P)/m*f                      

DOF = 2*c*N*(1/P + 1/m)/m                              (moving things around, f’s  and a couple 2′s cancel out)

DOF = 2*c*N*m*(1/P + 1/m)/m^2                 (multiply everything by “m/m”)

DOF = 2*c*N*(m/P + 1)/m^2                            (move the m into the “1/P + 1/m” part)

This is not quite like the typical DOF at macro equation in that it includes P, although it will be more accurate if you include P. Most of the time P is considered to be 1 and the equation turns into the one typically seen.

DOF = 2*c*N*(m+1)/m^2

Next: While I was looking at the original DOF diagram I also had insight into hyperfocal distance – the distance where the DOF on the backside of the focus plane goes to infinity.

28: Depth of field and high magnification

March 14th, 2010

With regular photography the depth of field is quite large, even when using a large aperture on the lens. With macro photography, depth of field is severely limited and is commonly much less than 1 mm. Now, it’s easy enough to produce an equation and show that the DOF is limited at high magnification, but with this posting I wanted to provide an explanation of this principle in a manner that isn’t too difficult to understand.

The first part that needs to be addressed is that, like numerical aperture and f-number, the work is done at the entrance pupil of the camera. That means that the size and position of the entrance pupil will make a difference in the DOF seen on an image.

There are two factors that determine the DOF in an image. 1) The relative size of the object circle of confusion vs. the size of entrance pupil. 2) How far apart the entrance pupil and the object sircle of confusion (focus plane) are from each other. These two factors will determine the DOF for near and far subjects.

As mentioned in a previous posting the object circle of confusion is just the relative size of the circle of confusion translated onto the object side of the lens.

c(o) = c/m                 ( c(o) = object circle of confusion, c = circle of confusion, m = magnification)

The relative size of the c(o) vs the entrance pupil is an important determinant of DOF. The circle of confusion for a typical dSLR is about 0.02 mm. That seems quite small, but with normal photography and a field of view of 5 meters, the magnification is about 1:200 and that means that the c(o) will grow to about 4 mm – in the same size range as the entrance pupil for many lenses.

Having the entrance pupil and the c(o) of a similar size means that the angle that the edge of the entrance pupil makes with the edge of the c(o) will be relatively small. That will tend to increase the DOF.

The opposite occurs are high magnification. At a magnification of 10:1 the c(o) becomes a quite tiny 0.003 mm – a thousand times smaller than a typical entrance pupil. This will tend to increase the angle from the entrance pupil and tend to decrease the DOF.

DOF vs. magnification. Far focus - top, Near focus - bottom

The size of the entrance pupil also helps to determine this relationship. Decrease the size of the entrance pupil (close the aperture down) and the angle will decrease and thus increase the DOF. The opposite occurs with opening the aperture up.

The distance that the entrance pupil and c(o) are from each other (the focus distance) also helps to determine the angle that the entrance pupil makes with the c(o). This factor is closely related to the size of the c(o). A large c(o) tends to be far away and a small c(o) tends to be close. If the c(o) is large and far away the angle will be small and thus have a large DOF.

With macro photography the c(o) tends to be small and close and will thus result in a small DOF.

27: Depth of field and the aperture

February 28th, 2010

The aperture is the main determinant of depth of field when using a camera. Open the aperture up and you will get less, close it down and you will get more. The question is: Why do you get more depth of field with a small aperture? To simplifiy things I will only be looking at the object side of the camera for this discussion. The same concepts apply on the object side as they do on the image side, so I will omit the image side for now.

Before we can get going, we need to define the circle of confusion in relation to the object side of the equation. We started by defining the circle of confusion in terms of the image. For a typical Nikon dSLR the circle of confusion is about 0.02 mm and the detector is about 23.6 mm wide. That translates into about 1/1200 of the width of the detector. To translate this to the object side you just need to know the width of your field of view and divide by 1200. This can also be written in terms of magnification as

c(o) = c/m           (where c(o) = object side circle of confusion, c = circle of confusion, m = magnification)

As magnification goes down (i.e. the field of view enlarges) the c(o) proportionally enlarges. As the magnification increases the c(o) proportionally decreases.

As the aperture closes the DOF enlarges

Now we can get about discussing the role of the aperture in DOF. The top part of the diagram shows a large aperture with a relatively narrow depth of field. The object circle of confusion is located at the focus plane and listed as c(o).  The bottom diagram shows the effect of closing the aperture. c(o) remains the same, but the angle of the rays extending from the lens to c(o) has decreased and this causes the depth of field to increase. At a narrow angle, it takes longer for the blur circle to enlarge to the size of the c(o) and thus the DOF is increased.

You will also notice that the increase is mostly on the far side of the focus plane. Because of the angles involved, there will always be more depth of field on the far side of the focus plane compared to the near side. As the field of view gets larger (lower magnification), that difference will increase. Typical photographers say that 1/3 of the DOF is in front of the focus plane and 2/3 is behind the focus plane. This is more of a rule of thumb than a fact as the actual distribution varies quite widely.
As the magnification rises into the macro photography range, the distribution of DOF becomes more equal on the far and near side of the focus plane. The distribution always favors the far side, but the difference becomes minimal at high magnification. Beacuse of this it is commonly assumed the the distribution is equal far to near with macro photography.
Next: Why is there so little DOF at high magnification?

26: Depth of Field – The basics, graphically

February 25th, 2010

I find that I can read a printed explantion and not be able to get a strong understanding of the concept. I need to see a graphical representation of the concept to really get a feel for it. Depth of field is much easier for me to understand with a nice diagram.

basic depth of field diagram

 The diagram above shows the basics of depth of field. An object at point y is at the focus plane and will be in sharp focus at the detector. An object at point x is behind the focus plane and will focus in front of the detector. The light rays from x won’t just stop at their focus point, they will continue on to the detector where they will form a blurred circle the diamter of c. The opposite will happen to an object at point z. since it will come into focus behind the detector it will also form a blurred circle the diameter of c.

If we define c as the amount of blur your eye tolerates in an image, c is the Circle of Confusion. The distance between oject x and object z is now the Depth of Field (DOF). An important point to remember is that not everything within the DOF is equally sharp. The object at the focus plane is sharpest and objects will get progressively fuzzier as you move either forward or backward. The fuzziness increases until it becomes visible at the limits of the DOF. Another point to remeber is the DOF is only valid under a certain image viewing size and distance. If I were to get up close and personal with the image (zoomed up to full size on a computer screen), objects the were sharp previously may now become fuzzy as I have now changed the image magnification and thus changed the CoC.

Next: How the aperture makes the DOF larger or smaller.

25: Depth of Field – The background

February 9th, 2010

Depth of field is aconcept based on the fact that your eyes will tolerate a certain amount of image unsharpness before the image appears “fuzzy.” That is, the object in the picture doesn’t have to be in perfect focus to still appear sharp. For a perfect lens, at the focus plane, the image is prefectly sharp. As you move forward or backward from the focus plane the resulting image will slowly get less sharp. The distance between the point in the front of the focus plane where the image starts to appear fuzzy to the same point on the back side of the focus plane is the depth of field.

The question is: At what point does the image become fuzzy? Well, that turns out to be a rather subjective quantity.  To find out the amount of fuzziness that a typical person can tolerate, we need to know how small of a detail can a person see on a typical photograph. Again, this number will depend upon the size of the image, the viewing distance and viewing conditions. Thankfully, those conditions have been standardized. Most people assume that a person is viewing an image about the size of an 8″ x 10″ from 25 cm away. In that situation, the smallest size detail that a person with good vision can see is about 0.2 mm. Anything on the image that is 0.2 mm or smaller will be considered “sharp.” If I were to change the viewing distance or image size, the numbers will change and thus the depth of field will change.

Remember that the 0.2 mm size is on a printed8 x 10 image. That image is likely an enlargement of the original negative or detector size. The 0.2 mm will be proportionally smaller on the negative or detector. That size turns out to be about 0.03 mm on a 35 mm negative. This number is termed the Circle of Cunfusion. Most digital cameras have detectors that are smaller than a 35 mm film frame so the circle of confusion (CoC) will be proportionally smaller as the image from the detector will need to be enlarged more to get to 8 x 10 size. Digital SLR’s commonly have a CoC of 0.02 mm (APS-C detector size) and most point and shoot cameras have a CoC that is considerably smaller yet (~0.005 mm).

How this number translates into real life images will be discussed in the next entry.

24: Numerical Aperture, the association of front to rear

February 7th, 2010

As with the front of the lens, the effective aperture can be easily converted into a numerical aperture (NA). 

NA_rear = 1/(2*N*((m/P) + 1))                  (where N = f-number of lens, m = magnification, P = pupillary magnification)

Computing a working NA for the rear of the lens isn’t particularly helpful for me as I prefer to use effective aperture. The interesting part is that the working NA for the front and the rear of the lens are tied together mathamatically.

NA_front = NA_rear*m

It’s a very simple association and it is completely independent of pupillary magnification. That means that with any lens of whatever pupillary magnification and f/number, any gains or losses in NA on the back of the lens associated with the pupillary magnification will have an proportional gain or loss in the  NA on the front of the lens. 

This association can also be tranferred  into terms of f/numbers where it is probably more useful to most photographers (microscopists work predominantly in NA terms).

Working f_num = Effective_aperture/m

As an example, if I have a lens set to f/4 with a P=1 and an m=5, the effective aperture is 4*(5+1) or f/24. Applying the above equation gives you a working f/number of  24/5 or f/4.8. That translates into a NA of  1/(2*4.8) or about 0.10. 

Another example is with microscope objectives. The NA listed on the objective is a working NA at the listed magnification. A 4x/0.10 objective has a working f/number at m=4 of  1/(2*0.1) or f/5. The effective aperture is (5*4) or f/20.

23: The working numerical aperture.

February 6th, 2010

In the previous entry we discussed the numerical aperture (NA) in similar terms to the f-number, referring the calculation to the front focal point. Measured at the front focal point, the resulting NA is the maximum possible for the lens. Imaging at the front focal point implies an infinite magnification and infinite image distance – not possible with any camera that I know.

That leaves us with calculating an effective or working NA – the numerical aperture that the entrance pupil forms with the object being photographed. Like the effective aperture on the image side, the working NA is determined by f/#, magnification, and pupillary magnification. The equation is very similar to the equation from the previous entry but with an added multiplier that takes into account the magnification and the pupillary magnification.

NA = 1/(2*N*((1/m)+(1/P)))                       (where N=aperture setting, m=magnification, P=pupillary magnification)

The above shows 3 f/4 lenses with different pupillary magnifications. The Eff-NA is largest for P=1/2 and smallest for P=2

You will notice that the f/4 P=2 lens has an Effective NA advantage on the front end just as it does on the back end of the lens with the Effective aperture. The same applies with the disadvantage with the f/4 P=1/2 lens. It turns out that there is an association between the NA on the front of the lens and the NA on the rear of the lens. That will addressed in the next installment.

22: The numerical aperture.

January 10th, 2010

The numerical aperture is the same concept as f/number but on the front of the lens. Whereas the f/number determines the image resolution, the numerical aperture determines the object resolution. Numerical aperture is the angle that the aperture makes with the front focal point.

The basic form of numerical aperture is determined by two measurements – the size of the aperture and the distance that the aperture is from the front focal point of the lens. A larger aperture that is closer to the focal point will have a larger numerical aperture (NA) and will result in higher potential object resolution. The NA is closely associated with the f/number of the lens.

NA = 1/(2*f-num)                   (where f-num = focal length/entrance pupil diameter)

and vice-versa:   f-num = 1/(2*NA)

Technically, the numerical aperture is the sine of the half angle that the aperture makes with the front focal point. I have seen various sources suggest that for small NA’s the tangent of the angle is a close approximation of the sine. While that assertion is true, it is superfluous. Why use an approximate tangent when the sine is correct? Maybe somebody can enlighten me. 

At first glance, it would appear that the NA is equal to the tangent of the angle as the NA is equal to half of the entrance pupil diameter divided by the distance from the entrance pupil to the focal point. The first time I looked at a typical diagram, I thought the same: Why sine and not tangent?

The usual way of diagramming the numerical aperture

The answer lies in the fact that the entrance pupil of a well-corrected photographic lens is not just a circle, it is a section from a sphere with a diameter f (focal length) centered at the focal point of the lens (based on a quote from Rudolph Kingslake – a well respected optical engineer so I’ll go with that).

That means that the hypoteneuse of my triangle is equal to the focal length. The vertical line down to the baseline of the triangle from the edge of the entrance pupil (En/2 in length). That means that the NA represents the sine of the angle and not the tangent.

The actual configuration of the numerical aperture

NA = sin(angle a) = (En/2)/focal length          (where En is the entrance pupil diameter)

Like f-number and effective aperture on the backside of the lens, there is NA and effective NA on the front. It is likewise affected by the magnification and the pupillary magnification. We will go into that concept in the next posting.

21: Why aren’t all macro lenses designed with a P>1

December 27th, 2009

Having a pupillary magnfication greater than one does provide a potential advantage in resolution at the detector compared to symmetric and telephoto lenses. So, why aren’t all lenses designed this way? It turns out that there are lots of reasons that lenses aren’t or can’t be designed this way.

As you will recall, having a P>1 means that the lens is retrofocus. With most SLR’s this design is necessary with shorter focal length lenses in order to allow infinite focus. The necessary displacement of the principal planes toward the detector characteristic of retrofocus lenses will cause you to have to give up some working distance. This is because the front principal plane also tends to be displaced toward the back of the lens with a retrofocus design. Since object distance is measured from the front principal plane, you will have more lens in front of it and thus less working distance. With non-macro work, this displacement makes little if any difference in the use of the lens. With macro imaging you may find that the object you are trying to photograph is running into the front element of the lens at a relatively low magnification. A good working distance is a highly prized feature for a macro lens.

A telephoto lens design (P<1) is just the opposite. These lenses tend to have extra working distance, but do pay a small penalty in resolution capabilities. Symmetric or nearly symmetric lenses are a good compromise between these competing factors. You may not get the same resolution capabilities inherent to a retrofocus design, but you will retain a reasonable working distance.

I honestly don’t know how all of these issues factor into lens design. I would guess that with a typical SLR lens is designed either retrofocus or telephoto out of necessity. The differences in resolution and working distance mean very little at non-macro focus distances. At high magnification, these factors become much more important and have to be considered in the design process. The question is: do you want working distance or improved resolution?

A small point to end this entry. The resolution difference between lenses of various pupillary magnification is really pretty small. The improvement can be easily shown mathematically, but in the real world the difference is generally minor. That’s why many choose to ignore this factor.