Abstract: Depth of Field - a Multipurpose Optical Calculator

Bob Atkins Photography


A Multipurpose Photographic Calculator, Depth of Field, Hyperfocal Distance...and More

This is a small Windows program I wrote in Visual basic as a handy calculator for a number of lens and image properties. It calculated near and far points in focus, hyperfocal distance and depth of field - as do many such calculators - but it does a little more. It should run on any version of Windows from 95 to XP.

Note I also have a simple web based calculator (written in Javascript) on my other DOF calculator page.

This program also calculates the maximum theoretical image resolution in the focused image plane (using diffraction theory) so you can see what stopping WAY down would do to your image, it calculates the degree of blurring of a very distant background object (at infinity), so not only can you see the depth of field, but you can also see how blurred those mountains in the distance will be! DOF and infinity background blur are not directly related, as you will see if you play around with the numbers.

Another thing which this program does is to alert you to conditions under which the calculations of DOF become meaningless. Depth of field calculations are done using simple geometric optics models, since that's normally all that is needed. They assume light travels in straight lines, diffraction doesn't happen and that light can be (and is) focused to an infinitely small point. None of these are actually true if you look closely enough.

This program calculates the diffraction limited spot size, which is the smallest possible point that the lens can focus light into, even if it's a perfect lens. When doing the geometric optics calculation of DOF, a value has to be chosen for the Circle of Confusion (CoC). This CoC value is the maximum diameter you want to allow for the image of a point in the focal plane. The bigger the point diameter, the more blurring you are willing to allow in the image at the "near" and "far" points of your depth of field.

However, as I said, the Geometric Optics treatment ignores diffraction, so it doesn't take into account that fact that the diffraction limited spot size could be greater than the number you pick for the CoC! Obviously it makes no sense to say, "what's the region where the image of a point will be less than the CoC" (i.e. what's the depth of field) if the diffraction limited spot size is larger than your chosen CoC everywhere. Under these conditions, DOF calculations become somewhat meaningless. It means that nowhere will the image be sharp enough to satisfy your CoC conditions. The whole image will be "fuzzy", even in the best focused parts. A warning notice appears on the screen under these conditions.

The program also calculated magnification, up to 1x (1:1). Note that 1x means the image on the film/sensor is the same size as the object being imaged.

NOTE ABOUT DIGICAMS: You can use this program for estimating the DOF given by small sensor digital cameras. However you must use the actual focal length of the lens, not the "35mm equivalent" focal length. So a typical 3x zoom digicam might have a lens with a actual focal length range of 7-21mm, even though the "35mm equivalent" range of 35-105mm may be how you normally think of it. The CoC value for small digicams depends on the physical size of the sensor, but somewhere around 6 microns is appropriate for most current cameras which have 1/1.8 size sensors, and 7 microns for those high-end digicams with 2/3" sensors (e.g Sony F828, Canon Powershot Pro 1)

Here's a screenshot of the program:

Photographic Depth of Field Calculator

Operation is very simple. You click on "start" to start, "print page" to print the page and "quit" to quit.

The only other operational controls are the 4 sliders for aperture, focal length, subject distance and circle of confusion value. Typical values for various formats are given. but you can use a smaller number if you want to see the range over which the image will be sharper then the conventional CoC value would give, or you can chose a larger number if you're prepared to live with a little less sharpness. There are also buttons for displaying the distance information in either feet or meters.

You cannot directly input data, you have to use the sliders. Recalcultions are done in real time as the sliders move, so you can easily see how the calculated output values change as you change the input variables.

You can download this program from the following link:

Depth of Field Calculator

In order to run, the program requires the Vbrun300.dll file be in your system folder. This may already be true for most people since many programs require it and some autoinstall it. If the program doesn't run, you can download a vbrun300.dll installer directly from the Microsoft website at http://support.microsoft.com/default.aspx?scid=kb;EN-US;q196285

The program is free for non-commercial use. If you find it useful and want to make a donation, see my Feedback page. Note that although the progam is freeware, meaning it is available at no cost for individulals to use for non-commercial purposes, it is NOT public domain, meaning that you can't sell it, incorporate it into any other product, distribute it or modify it in any way or use it to make money for yourself without first obtaining a written licence from the copyright and intellectual property owner, i.e. me!

Note that the decision to download this software and to run it on your system is up to you to make. I take and accept no responsibility for any problems which may occur as a result of downloading, installing or using this software.

The program is self contained in that it makes no changes to your system, the registry, nor does it create any new files. To remove it just delete the file.

Please feel free to link to this page - in fact I'd appreciate it if you would do so - so that other users can download the latest version of this program (assuming I develop later versions...).

© Copyright Bob Atkins All Rights Reserved