Dylan Hoen's Depth of Field and Diffraction Limit Trade-Off Calculator and Grapher



This program requires Sun's Java Runtime Environment version 6 or later (Untested with earlier versions).
I have created this program to help me learn when depth of field and diffraction are the limiting factors in image sharpness. I thought I might as well post it here for other people to use.
To learn more about the diffraction limit, go here.
To learn more about the depth of field limit, go here.
This program uses equations based on a simple single element lens. The results for multi-element lenses with internal focusing may not be accurate around extreme macro photography.
To download this calculator to a laptop, or portable device supporting Java 6, click here.
The source code is here: DepthOfField.java, BufferedCanvas.java

The top of the graph is the vertical resolution of the sensor.
The bottom of the graph is 0.
The width of the graph is set to about twice the distance from the Subject Near Distance to the Subject Far Distance.
The white curve is the lines per height graph of the sharpness of the recorded image.
The red crosshairs are the points where the image sharpness graph crosses the Subject Near Distance and the Subject Far Distance.
The magenta crosshair is the maximum sharpness in lines per height at the focal distance.
The green horizontal line is the lines per height sharpness limit of the Bayer Low Pass Filter on the sensor.
The orange horizontal line is the diffraction limit of this Aperture, Focal Length, and Sensor Size.
The turquoise curve is the lines per height sharpness limit of the circle of confusion of this lens at this Aperture, Focal Length and distance from the lens.
A yellow horizontal line shows your Min In-Focus Lines-Per-Height when the focal distance doesn't meet that value.
Yellow crosshairs show where the sharpness of the image equal the Min In-Focus Lines-Per-Height.
The default Min In-Focus Lines-Per-Height value is set to 4 lines per mm on an 8 1/2" X 11" piece of paper. (8.5" * 25.4mm/" * 4 = 863.6 lines per height) You may want to choose a different number depending on desired image size and expected amount of cropping.

The outer dark gray lines are the horizontal field of view and the inner dark gray lines are the vertical field of view. In this particular instance, the Y axis can be considered width or height and at the same scale as the X axis.

To use this program:
1 Enter your camera information and the desired focal length and subject distances of interest (The Focal Distance must be between the Subject Near Distance and the Subject Far Distance).
2 Press Graph Depth Of Field to see what's limiting the sharpness of your picture.
3a To calculate the optimal Aperture for the maximum sharpness from Subject Near Distance to Subject Far Distance, press the Calculate Aperture button.
3b To calculate the optimal Aperture and Focal Distance for the maximum sharpness from Subject Near Distance to Subject Far Distance, press the Calculate Aperture and Distance button.
3c To sacrifice the sharpness by 10% in order to get a wider aperture (some times 1 stop wider), press the Calculate A and D, larger A button.
3d To calculate the Hyper Focal Distance, enter your desired Aperture and Focal length and press the "Calculate Hyper Focal Distance" button. The hyper focal distance will be stored in Focal Distance and the closest distance in focus will be stored in Subject Near Distance.
3e To calculate the optimal Focal Distance and Aperture from a certain distance to infinity, enter the nearest distance you want in focus into Subject Near Distance and press Maximize Near Subject To Infinity, or you could enter a big number, like 100 meters, into Subject Far Distance and press the Calculate Aperture and Distance button.
3f To save your current settings into a URL that can be bookmarked, emailed to someone, or linked off of a webpage, press the Save As Linkable URL button.


This page has been viewed 987 times since July 31'th 2007.

2017 / 08 / 20 . 05:31:22