This is the first of what turned out to be a very deep dive into depth of field. To see all the other posts in the series, scroll down to the bottom of this page — below the comments — and you’ll find links to all the other posts.
I haven’t posted for a few days, and it’s not because I’ve been kicking back. I’ve been doing a lot of camera simulation work with the idea of discovering a better way to think about depth of field than the conventional one. Navigation tip: if you scroll down to the comments at the bottomof this page, you’ll find pingbacks from all the posts in this series, and you can click on them to be transported to any that might interest you.
For those of you wanting a little brush up on the usual way to manage depth of field, here’s a view from 50,000 feet:
Pick an allowable diameter for the “circle of confusion” (CoC) — a circle in which no detail is present — that produces just barely tolerable blurriness on the sensor. There are lots of ways to do this. You can map the sensor to the eventual print size, pick a viewing distance, and use the human contrast sensitivity function (CSF) to determine what level of detail will be just barely visible. You can apply a factor to the pixel pitch of the camera. Or you can use the markings on almost all older lenses, which usually give you about a 30 micrometer (um) CoC, which is pretty darned fuzzy.
Now that you’ve gotten your CoC, you can calculate the place to focus at any given f-stop that will make the things at infinity blurred to the extent of the CoC, That’s called the hyperfocal distance, and is burned into the minds of many landscape photographers. Using the hyperfocal distance with a modern high-resolution camera for subjects that are very far away is a recipe for blurriness unless the CoC is quite small.
I won’t bore you — and me — with the calculations involved.
Instead, take a look here.
For a deep dive into CoC and depth of field (DOF, note the different capitalization of the ‘O”; I’m not sure what that’s about, but it is the convention), look here. Warning: that paper is not just about conventional DOF calculations, but also about object field methods. Don’t know what those are? Stick around, and in three or four posts, I’ll get to them.
I’ve got a couple of problems with the conventional way of managing depth of field. Depth of field is a form of image blur. We photographers have other forms of blur we have to worry about.
- longitudinal chromatic aberration (LoCA)
- lateral chromatic aberration (LaCA)
- other lens aberrations
- motion blur
Save the last, the blur effects of the above are almost always — these days, at least — considered in terms of their effects on the spatial frequency response (SFR) of the camera/lens system. A common, and in my opinion, useful metric for SFR is MTF50, the point in the modulation transfer function (MTF) where the contrast drops to half its low frequency value. Here’s a well written and well reasoned discussion of the usefulness of MTF50 as a measure of sharpness. If after reading Jack’s post you are unconvinced, consider that the signal to noise ratio (SNR) at MTF50 is usually high enough that you can turn it into something very close to MTF90 in post, should you desire.
With respect to motion blur, I have done some testing to provide a bridge between blur is sensor pixels and MTF50.
So, I’d like to think about DOF in terms of its effect on MTF50 not only in terms of CoC. I’d also like to think about DOF as a component of image blur and manage the whole. There’s a particular tradeoff with aperture that’s important. Stopping down decreases blur by increasing DOF, but increases blur by increasing diffraction. How do you find the optimum?
My faithful companion in my exploration of how lens defocus affects blur in the presence of other blur sources is my camera simulator. Written in Matlab, it allows the simulation of
- diffraction (at three wavelengths)
- aggregate lens blur (all lumped into one method, at present)
- antialiasing (AA) filter effects
- fill factor effects
- Bayer color filter arrays (CFAs)
- arbitrary CIE 1931 compliant CFA filter spectra (the camera always meets the Luther criterion)
- pixel response nonlinearity (PRNU)
- arbitrary sensor pixel pitch
- arbitrary full well capacity
- arbitrary pre- and post-amp read noise
With not too much effect, I added defocus blur to the above list, modeling the blur kernel as a pillbox filter — an integration over a circular area, with equal weight everywhere within that area. This is entirely consistent with the CoC concept, but will yield MTF50 numbers when I feed the camera simulator a slanted edge input image.
The resulting code ran quite slowly for well out-of-focus settings. With a lot more effort than it took to add the defocusing calculations, I recoded the simulator to run usefully fast.
Here’s what it spits out:
I’m using a lens blur model that I originally created a couple of years ago to approximate the on-axis behavior of the Zeiss Otus 55/1.4. Now that I have improved my focusing accuracy with a motorized rail and my target with a razor blade edge, I now realize that my Otus model is actually somewhat worse than the lens itself, particularly at wide apertures. Nevertheless, it can serve as a stand-in for very good, if not great, 55mm lenses.
The horizontal axis of the graph is subject distance in meters. It’s a log to the base 10 scale, so a third of the way between 1 and 10 is about 2, and two-thirds is about 5. The vertical axis is MTF50 measured in cycles per picture height. The simulated sensor is 42 MP, 14 bit, full frame Bayer CFA with no AA filter, like the sensor in the Sony a7RII. Fill factor is 100%. I turned off all sources of noise (photon, read, PRNU) — they don’t affect slanted edge measurements much anyway, since the technique is intended to calibrate out noise. Diffraction is computed at 450, 550, and 650 nm for the respective blue, green, and red raw color planes. The CFA is Adobe RGB, and the illuminant is D65.
The lens is focused at 1000 meters, which at almost 20,000 focal lengths, is essentially infinity. When i use the CoC DOF method for critical work, I usually use a CoC with a diameter of about 1.5 times the sensor pixel pitch. In this case, that would be 6.75 micrometers (um). I’ve plotted on the bottom of the chart above the near distances for each f-stop for which a perfect (no diffraction, no aberrations) lens would have that CoC. This can be used to give us an indication of how the CoC way of thinking compares to MTF50.
You can see that f/5.6 (the yellow curve) is the sharpest aperture for our hypothetical lens. If you want to maximize sharpness over a range of subject distances, there is no reason to use a wider aperture. When the subject is in focus, we get MTF50s of better than 1800 cycles per picture height (cy/ph) which is very sharp for a 42 MP camera. At a defocusing CoC of 6.75 um, the MTF50 has dropped to a little over 1400 cy/ph, which is still very sharp. It looks like our 1.5 pixel rule of thumb is holding up, if sharpness for an in-focus subject is the standard of comparison.
Now look at the f/16 curve. If sharpness compared to that for an in-focus subject is the criterion, our CoC = 6.75 um depth of field calculation looks overly conservative; the f/16 curve has barely begun to droop at that point. Indeed, if you look at all the f-stops on the graphs and compare the CoC = 6.75 um markers to the MTF50 curves, you’ll find that the sharper the f-stop, the less conservative the CoC = 6.75 um calculation, if ininity sharpness at that f-stop is the criterion.
But who says that in-focus sharpness at any give aperture should be the criterion for managing DOF? Shouldn’t absolute sharpness take precedence? I believe it should, and if you look at the graph above with that in mind, some interesting ways of thinking emerge.
Let’s say you’re feeling very particular about sharpness, so you select 1600 cy/ph as your sharpness criterion, and you want to know what f-stop to choose to get MTF50 at or above that number as close as it can be when the lens is focused at infinity. Both f/5.6 and f/8 cross the 1600 cy/ph line at about the same place. But as you get closer to infinity, f/5.6 gives you a sharper image, so you should use f/5.6. Here is a counterintuitive situation. If 1600 cy/ph is your criterion, f/8 gives no more DOF than f/5.6!
If you’re not quite as picky, and choose 1400 cy/ph (still very sharp) as your standard, than f/8 does give a bit more DOF than f/5.6, but not by much, so you still might choose f/5.6 to get the greater sharpness for distant subjects — it depends on what’s important to you in the image.
Dropping down to 1200 cy/ph (at this point we’re giving up a a noticeable amount of the sharpness that we probably payed a lot of money to get when we bought the lens), it looks like it’s a coin-toss between f/8 and f/11. I’d probably choose f/8 under most circumstances, since that’s the sharper stop at distance. Again, this is counterintuitive if you’re used to thinking of DOF in the conventional way.
At 1000 cy/ph, f/11 is a better choice than f/16, so the pattern continues.
More to come.
Depth of field is an interesting topic.
For one, I find that effective hyperfocal focusing isn’t necessarily what you want; I don’t mind extremely distant things being slightly blurry in my photos, if it helps draw attention to a foreground subject.
Additionally, I find that the reduced peak sharpness of a diffraction- and blade-reflection-impacted narrow aperture can positively influence the depth of field by causing you to relax the CoC constraints.
It’s partially the *degradation* of sharpness relative to the peak, not just the absolute value, that affects the perception of depth of field.
El Aura says
Merklinger proposed an interesting approach to DOF in images with distant subjects. Instead of trying to get foreground and background into focus, set the focus to the background and select the f-stop such that relevant foreground details are discernible (but not perfectly sharp).
Yes, indeed. I referred to his work and gave a different link in my first post yesterday. I will have a lot more to say about the object field, but I want to cover the subject with an image plane orientation first.
Jerry Fusselman says
Unless I’m sadly mistaken, your link goes to Merklinger’s long pdf, but El Aura’s link goes to a seriously magnificent short an sweet description of Object-field methods.
It was my bad not to know about this shorter version. It was written much later than the PDF, I expect, and it contains some new ideas not in the book. It is better than the book in the sense that if you can only read one or the other, read this short piece, not Merklinger’s entire book.
What Merklinger changed in the short version is really interesting, and also wise, I believe.
Jerry Fusselman says
Hat’s off, El Aura! This is surely my favorite link of the year. What a magnificent description of object-field methods!
Plus, he gives a fine description of his thinking for “Cannon over Placentia, Newfoundland.” That’s the very image we have been discussing starting here:
The discussion led to multiple graphs, long computer runs, alternate solutions, etc.
Thanks so much for your link!
Max Berlin says
Would it be easy for you to run this model for a 21mm lens like the Zeiss Distagon and for a closer focal point ~ 10m ?
As well, the Otus at 10m ?
Thanks in advance if possible.
Max, given equal lens quality, the lens part of all these DOF curves scale with distance. If you want to get an idea of what the curve would look like for a 21mm lens, multiply all the distances on the curve I posted by 0.3818^2, or 0.1458 (21/55 = 0.3818). [Thanks to Jerry Fusselman for the correction.]
I will be doing some curves at closer focusing and subject distances.
Jerry Fusselman says
Jim, in your message to Max, instead of “multiply all the distances on the curve I posted by 0.3818 (21/55 = 0.3818),” do you perhaps mean to multiply the distances by (21/55)^2?
Jerry, yes I do. I thought when I first came up with that normalization that I should check it, and was in too much of a rush. Thanks for getting me pointed in the right direction. I have fixed the error.
Chris Livsey says
You are correct it does prompt you to think differently.
An obvious in retrospect, always the clearest view, is the “sharpness equivalent” at a given distance shown. So that f2 and f16, f11/f2.8 and f8/f4 all “match” MTF at that distance. I don’t find that intuitive because I never thought about it I suppose.
I’m left wondering what that magic distance is precisely and what use it could be to know it!!
Happy new year!
As usual, very interesting !
Stupid question maybe:
Is there a measurable influence of pixel pitch on achievable depth of field.
I mean, as an example, what’s the difference between an A7SII and an A7RII (Absolute MTF50 or CoC) and how does it measure / how to predict it ?
Have a good day