View previous topic :: View next topic 
Author 
Message 
rjlittlefield Site Admin
Joined: 01 Aug 2006 Posts: 20649 Location: Richland, Washington State, USA

Posted: Wed Mar 13, 2013 11:36 pm Post subject: A new way of thinking and calculating about DOF 


Here's a new way of dealing with DOF that may be helpful.
Instead of using geometric optics based directly on the circle of confusion, I'm going to compute DOF using wave optics, based on the effective fnumber and looking at wavefront error. Then I'll get at circle of confusion indirectly, by using that to determine what fnumber we should be using in the first place in order for diffraction to play nicely with that circle of confusion.
I warn you that this is probably going to look a little crazy, but I think it has some advantages in being simpler to think about once you get the hang of it.
Notation:
f_eff is the effective fnumber, as seen by the camera sensor
TDF is the total depth of field, front to back limit, as determined by the criterion of 1/4lambda wavefront error
NA is the subjectside numerical aperture
m is the magnification, from subject to sensor.
C is the diameter of the circle of confusion. We're going to take C as being proportional to the Airy disk diameter implied by the effective fnumber, and pick one to match the other.
Basic formulas...
Let's take it as always true that:
TDF = lambda/NA^2 [1/4lambda wavefront error, lambda = 0.00055 mm for green light]
NA = m/(2*f_eff)
and correspondingly
f_eff = m/(2*NA)
Doing the algebra, we have immediately that
TDF = lambda*4*f_eff^2/m^2
Now, for the sake of illustration let's choose to associate f_eff = 11 with C = 0.012. This corresponds to a rule of thumb that f/11 is the smallest aperture you can use on an APS sensor without losing resolution even at actual pixels (C ~= 1/2300 of sensor diagonal). It turns out this also makes C just a little smaller than the diameter of the Airy disk.
Then in general for other values of C we can say that a good choice is:
f_eff = 917*C [917=11/0.012, so scaling the aperture to match our choice of C]
Now we're set to look at some calculations.
Suppose we're using a 10X NA 0.25 microscope objective. Then we have that
f_eff = 10/(2*0.25) = 20
TDF = 0.00055*4*20^2/10^2 = 0.0088
You'll notice that this is just equal to the first term of microscopyu's formula.
On the other hand, at 1:1 and effective f/11, we have
TDF = lambda*4*f_eff^2/m^2 = 0.00055*4*11^2/1^2 = 0.2662
The traditional formula would come at this case from a different direction, using a nominal lens aperture of f/5.5 (effective f/11 at 1:1) and calculating as
TDF = 2*C*N*(m+1)/m^2 = 2*0.012*5.5*(1+1)/1^2 = 0.264
The results are a little different, about 1%. If we wanted them to come out exact, we could tweak the relationship between f_eff and C to make that happen. But forging ahead...
As another example, at 0.5X and effective f/11, we have
TDF = lambda*4*f_eff^2/m^2 = 0.00055*4*11^2/0.5^2 = 1.065
The traditional formula would use a nominal aperture of f/7.33 (=11/(0.5+1), producing effective f/11), so
TDF = 2*C*N*(m+1)/m^2 = 2*0.012*7.33*(0.5+1)/0.5^2 = 1.056
Again the numbers are slightly different, and by no coincidence it's by 1%, the same amount as before.
We can change sensor size by altering C and f_eff. If we're just scaling up the sensor to fullframe, without changing our criterion for final sharpness, then we'll need C = 0.012*1.6 = 0.0192 and f/17.6. Of course the magnification also has to increase by 1.6 in order to image the same subject size.
In that case the calculated TDF for what was the f/11 m=0.5 case is now f/17.6 m=0.8, and the calculations go like this:
TDF = lambda*4*f_eff^2/m^2 = 0.00055*4*17.6^2/0.8^2 = 1.065
TDF = 2*C*N*(m+1)/m^2 = 2*0.0192*9.78*(0.8+1)/0.8^2 = 1.056
It's important to notice that these are exactly the same TDF values that we got with the smaller sensor. When you change the sensor size, and you adjust the magnification to shoot the same size subject, and you adjust the aperture to get the same amount of diffraction blur, then you also get the same DOF, and vice versa. The only difference is that with the bigger sensor you get to use a smaller aperture setting on the lens (f/9.78 instead of f/7.3 in this case).
Let's try another one. How about m=3 with C=0.025  maybe we're shooting a small subject on an APS sensor but we don't care about pixelpeeping.
So, compute as:
f_eff = 917*C = 917*0.025 = f/23. (Makes sense  we can tolerate more diffraction blur with the larger circle of confusion.)
TDF = lambda*4*f_eff^2/m^2 = 0.00055*4*23^2/3^2 = 0.129
Now, if we're shooting with an ordinary lens on extension, to get f/23 at m=3 means that we need an aperture setting of 23/(3+1) = f/5.75.
The classic calculation would be
TDF = 2*C*N*(m+1)/m^2 = 2*0.025*5.75*(3+1)/3^2 = 0.128 (There's that 1% difference again  attributable to the scaling between C and f_eff.)
Your eyes may be glazed over by the numbers at this point. Mine too. Let's take a break from the numbers and think about why this formulation is useful.
It's useful because
a) it matches the physics (including diffraction),
b) it tells you how to optimize your aperture corresponding to the sharpness you need, and
c) effective aperture may be surprisingly easy to access, even with info you can get from a newbie user.
Here are some typical cases:
1. Modern Nikon body and lens: f_eff = camera setting
2. Canon body with macro lens: f_eff ~= camera setting*(m+1)
3. Lens on bellows or tubes at low magnification: f_eff ~= lens setting*(m+1)
4. Lens reversed on bellows or tubes at high magnification: f_eff ~= lens setting*(m+1)
5. Closeup lens on regular lens: f_eff = same as regular lens alone
6. Reversed combo, stopped in the rear: effective aperture = rear lens setting
7. Reversed combo, stopped in the front: f_eff ~= lens setting * m
8. Teleconverter with auto lens: f_eff adjustment is handled by camera
9. Microscope objective: f_eff = m/(2*NA)
I have the feeling that there's a great simplification here. Instead of having a large handful of complicated formulas, we have just one basic formula that's not very complicated, combined with a large handful of simple formulas to compute the parameter needed by the basic one. Throw in some decent way to determine magnification, let the user pick C, and you get a recommended aperture setting and DOF value at the same time.
It's late now, so I'm going to just post this out and come back tomorrow to read folks' reactions and try to answer whatever questions have come up.
One question is sure to come up so I'll address that now: haven't I ignored pupil ratio? Yes, I surely have. The rationale is that at low magnification P doesn't matter much, at high magnification P doesn't matter much either because typically you'll be reversing the lens, and at magnifications around 1:1 it would be strange to be using an asymmetric manual lens anyway. This reasoning fails on a few lenses like the 38 mm and 20 mm Olympus bellows macro lenses, because those have aperture values that are specified at infinity focus even though they're always used frontforward at high magnification. But the resulting error is not huge even for those  the 20 just acts more like f/2.7 instead of f/2.0.
Rik 

Back to top 


ChrisR Site Admin
Joined: 14 Mar 2009 Posts: 8520 Location: Near London, UK

Posted: Thu Mar 14, 2013 2:23 am Post subject: 


Looks fine (so far!)
One query on point 1, about Nikon lenses. I don't have any modern G Micros, for example but I think there's room for confusion. The 55mm f/2.8 manual ( still available, or was until very recently) doesn't do anything clever about the aperture as you focus. The really old 55 f/3.5 had a compensating aperture, but as far as I know that was unique.
Last edited by ChrisR on Mon May 13, 2013 6:04 pm; edited 1 time in total 

Back to top 


Peter M. Macdonald
Joined: 20 Jan 2009 Posts: 176 Location: Berwickshire, Scotland

Posted: Thu Mar 14, 2013 8:45 am Post subject: 


Rik,
This is very interesting. Has made a middle aged man think about some algebra that has been lying fallow for well over 30 years now.
Your typical case 9  Microscope objective has me wondering whether this is the same whether it is a finite objective on opticless extension such as tubes or bellows and an intinite lens using a tube lens for focus.
You can tell that I went to a school where you could do any two from physics, chemistry and biology. Physics was the lucky one  I chose the other two.
Best,
Peter 

Back to top 


rjlittlefield Site Admin
Joined: 01 Aug 2006 Posts: 20649 Location: Richland, Washington State, USA

Posted: Thu Mar 14, 2013 10:27 am Post subject: 


Peter M. Macdonald wrote:  Your typical case 9  Microscope objective has me wondering whether this is the same whether it is a finite objective on opticless extension such as tubes or bellows and an intinite lens using a tube lens for focus. 
For practical purposes it is the same. Manufacturers accurately specify NA for the objective used as designed, and the relationship that f_eff = m/(2*NA) is always true. If you change magnification by altering focus, then the objective moves farther or closer to the subject. This does change NA and f_eff, but the change is small compared to all the other uncertainties surrounding DOF.
Rik 

Back to top 


Peter M. Macdonald
Joined: 20 Jan 2009 Posts: 176 Location: Berwickshire, Scotland

Posted: Thu Mar 14, 2013 11:48 am Post subject: 


Rik,
Many thanks for assuaging my curiosity.
When I was setting up I used the calculators in the spreadshhets on Charles Krebs website as a rough guide and then ran some tests. Seems that, no matter how good the maths, a quick set of tests is inevitable at some stage of the process. It avoids the risk of user (maths) errors!
Peter 

Back to top 


rjlittlefield Site Admin
Joined: 01 Aug 2006 Posts: 20649 Location: Richland, Washington State, USA

Posted: Thu Mar 14, 2013 11:54 pm Post subject: 


ChrisR wrote:  One query on point 1, about Nikon lenses. I don't have any modern G Micros, for example but I think there's room for confusion. The 55mm f/2.8 manual ( still available, or was until very recently) doesn't do anything clever abou the aperture as you focus. The really old 55 f/3.5 had a compensating aperture, but as far as I know that was unique. 
Good information  thanks!
Most of what I know about Nikons is secondhand, from reading.
If somebody asks me about a particular body/lens combination, I will have to suggest an empirical test: see if changing focus also changes the maximum aperture as reported by the body. If it does, I think you can assume that what's being shown is effective aperture. If it doesn't, then either a) what's being shown is nominal aperture, or b) the lens has such a short focus range that the effective aperture doesn't change enough to matter.
If that test is not valid, please let me know how it fails.
Rik 

Back to top 


rjlittlefield Site Admin
Joined: 01 Aug 2006 Posts: 20649 Location: Richland, Washington State, USA

Posted: Fri Mar 15, 2013 10:22 am Post subject: 


I recently was pointed to a paper that has a more accurate formula for DOF at 1/4lambda wavefront error as a function of NA. (Thanks, michael_r!)
Above, I wrote that
Quote:  Let's take it as always true that:
TDF = lambda/NA^2 
Using the notation of the paper, the above formula corresponds to
deltaZ_BW = lambda/(2*NA^2)
while the more accurate formula is
deltaZ = lambda/(4*n*(1sqrt(1(NA/n)^2))) [n = refractive index of media, typically 1 for our purposes]
The lambda/NA^2 form is an asymptotic expansion of the more accurate formula. The relative error grows only a little faster than NA^2. It is about 1.6% at NA 0.25, 7.2% at NA=0.50, 9% at NA 0.55, increasing to 25% at NA 0.80 and larger beyond that.
The reference is "DepthofFocus in Microscopy" by Young, Zagers, van Vliet, Mullikin, Boddeke, and Netten at Delft University of Technology, published in SCIA ’93, Proc. 8th Scandinavian Conference on Image Analysis, Tromso, Norway, 1993, 493498. Google search finds a copy at http://homepage.tudelft.nl/e3q6n/publications/1993/SCIA93TYRZLVea/SCIA93TYRZLVea.pdf.
Rik
Edit: to add final matching parenthesis at end of formula.
Last edited by rjlittlefield on Wed Aug 23, 2017 8:01 am; edited 1 time in total 

Back to top 


DQE
Joined: 08 Jul 2008 Posts: 1653 Location: near Portland, Maine, USA

Posted: Fri Mar 15, 2013 6:17 pm Post subject: 


Rik,
Most interesting and a welcome alternative to the standard approaches.
Does the MPE65 lens, with its mechanical and optical acrobatics, pose any significant difficulties in applying these equations to estimate its DOF characteristics as a function of magnification and nominal fstop? _________________ Phil
"Diffraction never sleeps" 

Back to top 


rjlittlefield Site Admin
Joined: 01 Aug 2006 Posts: 20649 Location: Richland, Washington State, USA

Posted: Fri Mar 15, 2013 7:13 pm Post subject: 


DQE wrote:  Does the MPE65 lens, with its mechanical and optical acrobatics, pose any significant difficulties in applying these equations to estimate its DOF characteristics as a function of magnification and nominal fstop? 
Well, the MPE 65 is one of those lenses that changes focal length as it extends.
In general, the challenge with such lenses is trying to determine just what fnumber they're actually running at, as opposed to what the label says.
For the MPE 65, this actually turns out to be no big deal. If it were an ideal lens, its ratio of exposure times between 1X and 5X would be (1+1)^2 : (5+1)^2 = 1:9. I just now measured the beast and got an exposure time ratio of 1:8, which is within measurement error for the test.
My Canon 100 mm f/2.8L macro is also well behaved, exhibiting an exposure time ratio of 1:4 between infinity focus and 1X. Likewise for my Sigma 105 mm f/2.8 EX.
I have heard tales of other macro lenses that only lose one stop between infinity and 1X, not two stops as would be expected from standard theory. I haven't observed that personally, however.
Rik 

Back to top 


Peter De Smidt
Joined: 05 Jan 2012 Posts: 233

Posted: Fri Mar 15, 2013 7:46 pm Post subject: 


Please forgive me for being mathchallenged, but regarding:
Quote:  The traditional formula would come at this case from a different direction, using a nominal lens aperture of f/5.5 (effective f/11 at 1:1) and calculating as
TDF = 2*C*N*(m+1)/m^2 = 2*0.012*5.5*(1+1)/1^2 = 0.264 
are the units for the 0.264 figure millimeters? _________________ www.peterdesmidt.com/blog 

Back to top 


rjlittlefield Site Admin
Joined: 01 Aug 2006 Posts: 20649 Location: Richland, Washington State, USA

Posted: Fri Mar 15, 2013 8:13 pm Post subject: 


Peter De Smidt wrote:  are the units for the 0.264 figure millimeters? 
That doesn't sound "mathchallenged to me"  good question!
In that formula all of the variables are "dimensionless" except for C. As a result, if C is specified in millimeters, that's the unit of the result also. If you specify C in inches, the result comes out that way too.
It's the same way in the other formulas, except that there lambda provides the units.
Rik 

Back to top 


Peter De Smidt
Joined: 05 Jan 2012 Posts: 233

Posted: Fri Mar 15, 2013 8:26 pm Post subject: 


So for green light with a ¼ lambda wavefront error and an f4 lens at 1:1, would we get:
TDF = 0.00055mm * 4*8^2/1^2 = 0.1408mm ?
Knowing the TDF in that situation would be useful for my film scanner project. _________________ www.peterdesmidt.com/blog 

Back to top 


rjlittlefield Site Admin
Joined: 01 Aug 2006 Posts: 20649 Location: Richland, Washington State, USA

Posted: Fri Mar 15, 2013 8:48 pm Post subject: 


Quote:  So for green light with a ¼ lambda wavefront error and an f4 lens at 1:1, would we get:
TDF = 0.00055mm * 4*8^2/1^2 = 0.1408mm ? 
That's what I get. The number corresponds to the classic DOF formula with CoC = 0.0088 mm. That's obviously a stringent criterion but it seems completely in line with pixelpeeping an f/8 effective aperture.
Rik 

Back to top 


Peter De Smidt
Joined: 05 Jan 2012 Posts: 233

Posted: Fri Mar 15, 2013 8:53 pm Post subject: 


Thank you, Rik. That's very helpful! _________________ www.peterdesmidt.com/blog 

Back to top 


rjlittlefield Site Admin
Joined: 01 Aug 2006 Posts: 20649 Location: Richland, Washington State, USA

Posted: Thu Apr 11, 2013 12:36 am Post subject: 


Here's a work in progress that may be helpful.
What I've done is to construct a "DOF Two Ways" spreadsheet.
Way #1 is a classic DOF calculation based on circle of confusion, working from sensor dimensions and using a stringent spec of 2.5 pixels per CoC.
Way #2 is a wave optics calculation based on 1/4 lambda wavefront error as outlined above, using lambda = 0.00055.
The final output is two things:
1. A suggested step size = 0.8*max(Way#1,Way#2)
2. A note about whether the system is "diffraction limited", "sensor limited" or "near optimum", based on whether the two Ways are within 10% of each other.
I've posted it out as an Excel 2003 spreadsheet.
Here are sample screenshots:
This has not been checked very carefully. All comments appreciated!
Rik
EditCR Search tag: DOF two ways 

Back to top 


