## DOF versus lens length and sensor size

A forum to ask questions, post setups, and generally discuss anything having to do with photomacrography and photomicroscopy.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

rjlittlefield
Posts: 23853
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

### DOF versus lens length and sensor size

Questions are frequently asked regarding DOF versus sensor size and/or focal length. This posting is yet another attempt to try getting the relationships laid out clearly.

I'll start with the conclusions, then justify them with numbers computed by a spreadsheet you can play with yourself.

Assume we're comparing camera and lens setups such that:
• All setups have the same field of view for the in-focus subject.
• All setups use apertures chosen to give the same nominal DOF.
Then:
• Sensor size has nothing to do with the appearance of background.
• Focal length makes no difference in the diameter of blur circles as measured in the scene being photographed.
• Shorter lenses do give backgrounds that look sharper. This is because the background is magnified less, leading to smaller blurs in the image even though blurs are the same size in the scene.
• Effective f-number is directly proportional to sensor size. This implies that the tradeoff between DOF and diffraction blur does not depend on sensor size. This is because the Airy disk scales in proportion to effective f-number and thus in proportion to sensor size, so diffraction blur remains constant in the final image as viewed.
OK, now for some justification.

My strategy this time is to compute the sizes of blur circles based on very simple "first principles" analysis using nothing more than similar triangles and the thin lens formula 1/f = 1/o + 1/i.

The computation is packaged as a spreadsheet that makes it easy to compare the results of up to three different setups that all capture the same field of view with the same nominal DOF.

Input to the computation are just a few numbers:
• Field of view at the in-focus subject (same for all setups)
• Distance from subject to some background point (same for all setups)
• Sensor size (may vary between setups)
• Distance from lens to subject (may vary between setups)
• Nominal f-number for the first setup.
For the first setup, the computation proceeds as follows:
• Determine required magnification, given the sensor size and field of view.
• Determine distance from lens to sensor to yield that magnification.
• Determine lens focal length needed to focus at those distances.
• Determine effective f-number and ratio between effective f-number and sensor size.
• Determine "nominal DOF" using a standard formula.
• Determine lens-to-subject distance at rear limit of that nominal DOF.
• Determine blur diameters for a point at that rear limit.
• Determine lens-to-background distance.
• Determine blur diameters for a point on the background.
For the second and third setups, an aperture setting is determined that gives the same DOF according to the standard formula. Then a first-principles computation is done as for the first setup.

Here are some spreadsheet results that illustrate the conclusions.

First, let's vary the sensor size from 4 to 100 mm, while keeping the lens at the same position. Notice that the lens focal length, nominal f-number, and effective f-number must change to maintain constant field width and constant DOF. But the ratio of effective f-number to sensor size ends up being the same in every case (row 14). Notice also that the blur circles are constant both in the image and in the scene (rows 20:21 and 27:28).

Second, let's keep the sensor size constant, while changing the lens-to-subject distance. Notice in this case that there are changes in the sizes of blur circles as measured in the image, that is, as fraction of field width (rows 21 and 28). These changes are tiny for points that are near the focus plane (row 21), but large for points in the far background (row 28). On the other hand, as measured in the scene, the blur circles are the same size in each setup (rows 20 and 27). Hence my comment that shorter lenses give backgrounds that appear sharper because they give less magnification for backgrounds.

In other words, it's just a matter of perspective. Shorter lenses give a wider angle of view, which changes the subject-to-lens distance in such a way that the background looks smaller. Making the background look smaller doesn't let you see more detail in any given part of the background, but it does give you more background to see detail in. It's worth noting that the results I'm showing here are exactly the same as those shown by this Luminous Landscape tutorial for telephoto versus wideangle lenses. Backgrounds shot with the wideangle look sharper, but that's only because the background is rendered with lower magnification. The level of detail visible in the background is unchanged.

You can download a copy of the spreadsheet HERE and play with it yourself. If you don't like my choices for distances and lens lengths -- and you probably won't, because they're pretty extreme -- then plug in your own and see what happens.

For completeness, here are the formulas:

I hope this helps.

--Rik

P.S. If you find a mistake, please let me know. I've cross-checked this thing as well as I can by myself, but that's still only one set of eyes.

rjlittlefield
Posts: 23853
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:
Of course there are always several ways to look at the same phenomena.

In this post, LordV writes that
I'm always reminded of some amazing movie shots in one of david attenboroughs series (Life in the Undergrowth) where I think they were using almost endoscope type setups and had a picture of an ant in the foreground in clear focus at the equivalent of about 2X mag on a 1.6 crop camera with David attenbourough in pretty good focus in the background sitting at least a foot or two behind the ant. He was actually OOF of course but clearly recognisable. Suspect this is a combination of the OOF elements being clearly recognisable with a very short focal length lens and also the the cropping effect of a smaller sensor giving more DOF when enlarged (ie the lens magnification was not really 2:1)
The smaller sensor plays no role, but it really is true that a short lens will serve Sir David better in this case.

Let us pose the following requirements:
• 10 mm FOV at focus, for the ant.
• 250mm FOV in the background, for David's head.
We will achieve the latter requirement by sliding David's chair back however far is needed, given the lens in use.

To run this experiment requires a slight modification to the spreadsheet and its mode of use. Skipping past those details, here are the results:

Notice that the longer lens requires placing David quite a bit farther back in order for his head to appear the same size. Moving him back several times farther puts him several times farther out of focus, and the blur circles grow in proportion. David's face becomes more blurred in every respect when using the longer lens, even though the ant looks just the same.

--Rik

Details... This computation was done by modifying two rows of formulas as follows,
,
then Goal-Seeking the distances in row 23 to provide 250 mm field width in row 30.

rovebeetle
Posts: 308
Joined: Thu May 22, 2008 4:21 am
Location: Vienna, Austria
Contact:
Great post!!

Cheers
Harry

LordV
Posts: 1571
Joined: Thu Nov 22, 2007 10:28 am
Location: UK
Interesting stuff Rik - thanks for all the calculations and explanation.

I hesitate to post this but...

One thing though still intuitively bothers me and I suspect it's to do with the starting assumptions re sensor sizes and some misconceptions on my part.

Imagine I have a 35mm camera, 3 different focal length macro lenses, a target subject say 5mm long and various bits of background subject behind it. I want to produce 3 prints at 12*8 with the same aperture set on the camera and the same "print magnification" of the subject. I intend to use a full size image with the longest lens, with the middle lens I am going to crop the image in half before enlarging and with the shortest lens I am going to crop the image in half again (ie only 1/4 of the area of the original) before enlarging.
I assume in these scenarios I am going to end up with apparent DOF differences caused by the changing focal lengths but am I not going to end up with real DOF differences caused by the cropping (ie equivalent to using different sensor sizes) ?

Brian v.
www.flickr.com/photos/lordv
canon20D,350D,40D,5Dmk2, sigma 105mm EX, Tamron 90mm, canon MPE-65

Harold Gough
Posts: 5786
Joined: Sun Mar 09, 2008 2:17 am
Rik,

I believe that what you call "blur circles" are better known to some of us as "circles of confusion". For some reason, I relate more to the latter.

Harold
My images are a medium for sharing some of my experiences: they are not me.

DaveW
Posts: 1702
Joined: Fri Aug 04, 2006 4:29 am
Location: Nottingham, UK
I also understood that you got more apparent depth of field in a TV natural history pictures because the TV camera and screen produced much lower resolution than a photo print. Hence any circle of confusion (blur circle) below a certain size looks sharp compared to the rest of the obviously out of focus parts.

In a print with it's higher resolution the eye can distinguish the extra degrees of sharpness that the TV's lower resolution masks, so TV DOF appears greater?

Really like the human eye in a sense where any blur circle below a certain size appears a sharp point. With TV even larger blur circles appear relatively sharp points due to it's lower resolving power? No doubt the same applies to computer screens.

All terms for the circle of confusion seem to be equally acceptable and used in literature:-

"In optics, a circle of confusion is an optical spot caused by a cone of light rays from a lens not coming to a perfect focus when imaging a point source. It is also known as disk of confusion, circle of indistinctness, blur circle, or blur spot."

http://www.rags-int-inc.com/PhotoTechStuff/DoF/

http://www.kenrockwell.com/tech/bokeh.htm

DaveW

rjlittlefield
Posts: 23853
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:
LordV wrote:One thing though still intuitively bothers me and I suspect it's to do with the starting assumptions re sensor sizes and some misconceptions on my part.
I know those bothersome intuitions. I had them too, and it took a long time to get past them. The problem is that our assumptions and our terminology make it easy to lose track of what's being kept constant and what's being changed.
Imagine I have a 35mm camera, 3 different focal length macro lenses, a target subject say 5mm long and various bits of background subject behind it. I want to produce 3 prints at 12*8 with the same aperture set on the camera and the same "print magnification" of the subject. I intend to use a full size image with the longest lens, with the middle lens I am going to crop the image in half before enlarging and with the shortest lens I am going to crop the image in half again (ie only 1/4 of the area of the original) before enlarging.
I assume in these scenarios I am going to end up with apparent DOF differences caused by the changing focal lengths but am I not going to end up with real DOF differences caused by the cropping (ie equivalent to using different sensor sizes) ?
Before directly addressing your question, I want to repeat some background that has been discussed elsewhere.

To a very good approximation, the image that you get depends entirely on the entrance pupil. Any two setups that have the same location and size of the entrance pupil will produce images that have the same perspective, DOF, and diffraction blur. A simple intuition is that the entrance pupil determines what light gets through the lens to be captured by the sensor. If two setups capture the "same light", they produce the "same image".

In practice, it is hard to keep the entrance pupil at the same place with two different lenses. When the entrance pupil moves, the perspective changes, and there's nothing you can do about that. However, you can still get the same DOF and diffraction blur by setting the apertures so that the angles of the entrance cones are the same.

Where things get confusing is that exactly the same entrance cone can be described by a bunch of different f-numbers. Conversely the same f-number can describe a bunch of different entrance cones.

We're used to thinking and talking about f-numbers and not entrance cones, so unfortunately we're conditioned to pay attention to the wrong number.

To answer your question, it depends on what you mean by "same aperture".

If you mean "same entrance cone", then the answer is "all the images will have the same DOF".

If you mean "same f-number", then the answer is "the images will have different DOF." As an example, f/5.6 on a short lens describes a smaller entrance pupil than f/5.6 on a long lens. The smaller entrance pupil will give a narrower entrance cone and correspondingly greater DOF.

Does that help?

--Rik

rjlittlefield
Posts: 23853
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:
Harold Gough wrote:I believe that what you call "blur circles" are better known to some of us as "circles of confusion". For some reason, I relate more to the latter.
It sounds like you understand the two phrases to mean the same thing that I intended. That's good.

Unfortunately, the term "circle of confusion" is often taken to mean "the maximum permissible circle of confusion", which is not what I intended.

I've been through some arduous discussions caused by different interpretations of "circle of confusion".

Hoping to avoid more of those, I use the term "blur circles" because I think it's less likely to be taken wrong, even though for people like yourself it loses some impact.

--Rik

rjlittlefield
Posts: 23853
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:
DaveW wrote:I also understood that you got more apparent depth of field in a TV natural history pictures because the TV camera and screen produced much lower resolution than a photo print. Hence any circle of confusion (blur circle) below a certain size looks sharp compared to the rest of the obviously out of focus parts.
This is getting at the very important point of what it takes to "look sharp".

There are several issues here.

One of them is physical and has to do with display resolution. If the image is eventually ending up on low resolution media, then you can stop down farther without softening the image as displayed.

Another issue is perceptual: a moving image can show less detail than a still image and still look good.

Both of these issues cause videographers to stop down farther than a still photographer would, thus getting more DOF.

A third issue is also perceptual: we humans judge sharpness partly by comparison with surroundings. This gives a little extra leeway in macro photography, since the typically large expanse of OOF background tends to make the sharp stuff look even sharper. But this effect seems to apply equally to still and video, and in any case I suspect it's relatively weak compared to the first two issues.

All three of these issues are different from "DOF versus lens length and sensor size", except that coincidentally video cameras often use small sensors and thus come equipped with short lenses, just like compact digital cameras.

--Rik

ChrisR
Posts: 8671
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK
(It's 1:30 am and I'm not sure I follow 100% of the above, yet)

One "error" I haven't got round to checking on a spreadheet is a comparison with the "other" standard dof formula pair which show you get more in focus behind the subject plane than in front. The background in wide-angle shots is more likely to be non-macro of course, where the difference becomes larger.

I tried a couple of mods to the sheet to see what angle of view you would get with lenses you might actually choose, where the focal length is in proportion to sensor size. (I arbitrarily used 1.5x) It shows how much wider the small-sensor camera view angle becomes. That with Rik's posts above, and a contribution from the "error" mentioned, combine to show the effect I'm familiar with - you get more stuff looking sharp when you use a smaller camera.
It seems that Mathematical analysis of a subset of the factors, and tests designed to demonstrate specific relationships, don't necessarily tell the whole story.

The last line here is the one I added to Rik's SH, formula shown below it.

Edit:
I've just noticed a slip. I meant to enter 54mm for the FL of the lens on the 36mm sensor, to match the 9 for the 6mm. This yields a 19 degree fov. Shows the same effect as described, but to a lesser extent.
Last edited by ChrisR on Wed Dec 16, 2009 6:13 pm, edited 1 time in total.

DQE
Posts: 1653
Joined: Tue Jul 08, 2008 1:33 pm
Location: near Portland, Maine, USA

### re blur circles, etc

Before retiring a few years ago, I worked primarily on evaluating image quality in medical radiographic imaging systems. Although lenses and optics are not usually involved in such imaging, most image quality concepts are similar to those used in light-based photography.

A term commonly used in imaging science is the "point-spread function", abbreviated as the "PSF". The PSF describes how a point of light (or whatever radiation you are imaging) spreads out on the image plane, in this context, the camera sensor. Once you know the PSF, which in the simplest cases is invariant across the image plane, you can calculate the Modulation Transfer Function (MTF), which is the optical analog of an audio frequency response function in a hi-fi system. I hope this analogy helps. A perfect imaging system has a PSF that is a point, and its MTF is flat (independent of spatial frequency. A perfect or ideal audio system has a flat MTF, independent of audio frequency. There are of course some complications when you include the discrete nature of digital imaging systems, pixel width and spacing effects, etc.

Here's a link to a wikipedia entry on PSF (fair warning - lots of math here):

Now for my question - is the PSF essentially the same concept as the blur circle you are using in your most enjoyable essay/tutorial?

I hope this possibly irrelevant question is not too distracting.
-Phil

"Diffraction never sleeps"

rjlittlefield
Posts: 23853
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

### Re: re blur circles, etc

DQE wrote:is the PSF essentially the same concept as the blur circle you are using in your most enjoyable essay/tutorial?
Yes, with caution.

Suppose you have a point source. The blur circles that I'm talking about are essentially images of the aperture. (You see already that the term "circle" is a perversion, since most apertures are obviously polygonal!) Anyway, if the lens has no aberrations, then all areas within the blur are equally bright and the blur has a hard edge. Thus my geometric "blur circles" correspond to a PSF that is essentially a box function: zero everywhere except over a central region where it has a constant positive value. In practice, lens aberrations change this form a little bit by either rolling off the edges (producing a soft-edged blur) or brightening the edges (producing a bright-ringed blur). See HERE, middle of the page at Figure 6.

In contrast, the PSF's that describe blurring of in-focus points due to lens aberrations and/or diffraction are much smaller and smoother. They tend to look like very narrow bells, rather than broad boxes.

From a formal standpoint, all PSF's can be treated by the same mathematics such as 2D Fourier transforms.

--Rik

rjlittlefield
Posts: 23853
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:
ChrisR wrote:It seems that Mathematical analysis of a subset of the factors, and tests designed to demonstrate specific relationships, don't necessarily tell the whole story.
That's pretty much inevitable any time you have a lot of factors. Let's see, in various discussions we've talked about focal length, f-number, sensor size, entrance pupil location, entrance cone angle, field of view, angle of view, distance from camera to subject, on-sensor magnification, final print magnification, cropping, ISO setting, shutter speed, and now we've added distance to background and width of background. I can't even imagine telling the "whole story" over that collection of things to vary.

We've discussed before this concept that "you get more stuff looking sharp when you use a smaller camera".

The outcome of those earlier discussions was (and remains) pretty straightforward -- if you image the same field of view through the same entrance pupil (position and diameter), you get the same DOF regardless of sensor size. If instead of setting the same entrance pupil diameter you decide to set the same f-number, then the smaller camera with its shorter lens will give more DOF because you've made the entrance pupil smaller. In compensation for the increased DOF, you have to accept more diffraction blur. That same tradeoff could also be made with the larger sensor by stopping down to the same entrance pupil.

What we're now talking about in this thread is a different situation. We're imaging the same in-focus field of view from different distances, thus giving different angles of view, and while we're doing that we're looking at what happens in the far background. What happens in this case is that the lens with the wider angle of view sees more background area at the same level of detail, or alternatively, sees the same amount of background at a shorter distance and a greater level of detail.

If this is a situation that you've been talking about previously, then I apologize for not recognizing it.

I believe you'll find that my spreadsheets are completely consistent with the standard DOF formulas. It's just a different formulation of the same geometry. You always get more DOF behind than in front. The wrinkle is that at far focus, you get a lot more, while at macro focus, you get only a little more.

This is easy to demonstrate using the spreadsheet linked above. In cell B23, "Distance from subject to background point (mm)", change the value from 300 to 0.20444444 (in back of the focus plane) and note that in line 28, the blur diameter (fraction of field) has value 0.000979965. Then change B23 to be -0.20444444 (negative value means in front of the focus plane), and note that the line 28 blur diameter increases to (-)0.001020871. That slightly larger blur diameter in front corresponds to less DOF in front, but the difference is only about 4%. This contrasts sharply with what happens at the hyperfocal distance, where you get DOF to infinity behind, but only some finite amount in front.

--Rik

Edit: to fix typo
Last edited by rjlittlefield on Wed Dec 16, 2009 12:48 am, edited 3 times in total.

LordV
Posts: 1571
Joined: Thu Nov 22, 2007 10:28 am
Location: UK
Thanks for the explanations and patience Rick - appreciated.
In my proposed shot sequence i was purposely not talking about diffraction, not keeping the FOV constant, just keeping the print magnification of the subject and the F-number set on the camera constant - I realise that introduces a lot of variables

Brian V.
www.flickr.com/photos/lordv
canon20D,350D,40D,5Dmk2, sigma 105mm EX, Tamron 90mm, canon MPE-65

Harold Gough
Posts: 5786
Joined: Sun Mar 09, 2008 2:17 am