# A Simple Model for Sharpness in Digital Cameras – Defocus

This series of articles has dealt with modeling an ideal imaging system’s ‘sharpness’ in the frequency domain.  We looked at the effects of the hardware on spatial resolution: diffraction, sampling interval, sampling aperture (e.g. a squarish pixel), anti-aliasing OLPAF filters.  The next two posts will deal with modeling typical simple imperfections in the system: defocus and spherical aberrations.

#### Defocus = OOF

Defocus means that the sensing plane is not exactly where it needs to be for image formation in our ideal imaging system: the image is therefore out of focus (OOF).  Said another way, light from a distant star would go through the lens but converge either behind or in front of the sensing plane, as shown in the following diagram, for a lens with a circular aperture:

The Point Spread Function (PSF) on the sensing plane appears to be a uniform disk of light – and that’s indeed what geometrical optics predicts.  It would therefore be tempting to assume that the MTF of defocus is just the normalized modulus of the Fourier Transform of a uniform disk, which we know from past articles to be an Airy disk, this time in the frequency domain[1]. That is a correct assumption when the optical path error is of the order of a couple of wavelengths of the incident light or more.

#### Defocus and Diffraction

However a couple of wavelengths of defocus optical path difference (OPD, better defined in reference 2 below) is a very large error, Lord Rayleigh suggesting that an unaberrated system should stay within OPD.  But as distances dip below a couple of wavelengths OPD, diffraction plays an increasingly large role in determining the final shape of the PSF and consequent MTF.  H.H. Hopkins derived a formula for the MTF of sub-wavelength defocus as a function of OPD , as outlined in his 1955 paper[2]    and adapted by Jeff Conrad[3] for our uses here:

*** QuickLaTeX cannot compile formula:
\begin{equation*}
\begin{align*}
MTF_{defocus} &= \frac{4}{\pi a}\displaystyle\int_{0}^{\sqrt{1-s^2}}sin\bigg[a\cdot\bigg(\sqrt{1-y^2}-s\bigg)\bigg]dy \\
a &= W_{020} \cdot |s| \cdot \frac{8\pi}{\lambda}
\end{align*}
\end{equation*}

*** Error message:
Cannot connect to QuickLaTeX server: cURL error 28: Connection timed out after 10000 milliseconds
Please make sure your server/PHP settings allow HTTP requests to external resources ("allow_url_fopen", etc.)
These links might help in finding solution:
http://wordpress.org/extend/plugins/core-control/
http://wordpress.org/support/topic/an-unexpected-http-error-occurred-during-the-api-request-on-wordpress-3?replies=37

with

• the maximum Optical Path Difference in microns at the edge of the aperture, and
• the linear spatial frequency normalized for diffraction extinction: .
• The MTF is 1 at zero frequency and zero when  is greater than 1.

The equation yields a 1D radial slice of the 2D MTF of defocus.  Since the function is circularly symmetric the 2D MTF can be obtained by simply rotating the function around the central axis.  From the same paper we also gather that , the error in the position of the sensing plane with respect to the optical axis is given by

*** QuickLaTeX cannot compile formula:
\begin{equation*}
d_z = 8N^2\cdot W_{020}
\end{equation*}

*** Error message:
Cannot connect to QuickLaTeX server: cURL error 28: Connection timed out after 10000 milliseconds
Please make sure your server/PHP settings allow HTTP requests to external resources ("allow_url_fopen", etc.)
These links might help in finding solution:
http://wordpress.org/extend/plugins/core-control/
http://wordpress.org/support/topic/an-unexpected-http-error-occurred-during-the-api-request-on-wordpress-3?replies=37

in the same units as , with the effective lens f-number.

And, with paraxial approximation, the diameter of the defocus disk on the sensing plane is

(1)

k in the same units as .

#### The Effect of Defocus on MTF

We are now ready to show the effects of different amounts of defocus on an ideal diffraction limited imaging system with a circular aperture by applying equation (1), which fortunately is easy to solve numerically[4].  It produces the following MTF curves for different amounts of optical path difference , with f-number 5 and wavelength 0.5 microns chosen to be consistent with Hopkins’ paper:

The top most line has no defocus therefore it represents pure diffraction, as expected.  The others show increasing amounts of defocus, starting from lord Rayleigh’s criterion for in-focus at 0.25.

Also note that beyond about OPD the relative response curve goes negative.  This indicates phase inversion, an example of which is seen on the cutout of the Siemens star on the cover of Boreman’s book.  Since MTF is the modulus of the function these negative values should in fact be rectified but I left them there this time to emphasize the point.

As mentioned, this equation refers to the the radial 1D MTF of a circularly symmetric function, so the relative 2D MTF plot can be obtained by simply rotating this slice through 360 degrees.

Spherical Aberrations Next.

#### Notes and References

1. See this Berkeley paper for the FT of a uniform disk.
2. The Frequency Response of a Defocused Optical System, H.H. Hopkins, Proceedings of the Royal Society, 19 July 1955.
3. The spatial frequency s used in Hopkins’ original paper is actually twice that used in this version of the formula, which was obtained from an excellent Jeff Conrad paper, Equation 117.
4. The Matlab/Octave scripts used to generate these plots can be downloaded from here.