I'm aware that diffraction limits the maximum optical resolution of any lens, especially when stopped down to very small apertures. Some camera manufacturers, such as Pentax and Olympus, have introduced a post-processing feature designed to compensate for it.

Given that deconvolution can effectively compensate for intrinsic lens defects and that diffraction is a systematic, image-wide effect that applies uniformly across the image, is it possible to simply deconvolve the diffraction to restore sharpness?


1 Answer 1


Yes, using deconvolution you can invert any linear map from a hypothetical sharp image to a (hypothetically noise free) unsharp image. The actual image you have is not just an unsharp image caused by diffraction it also contains noise which will limit the effectiveness of deconvolution.

In general, the problem is easy to describe. A point in the scene that is imaged should only affect a single pixel, but in an unsharp image this now appears as a pattern of pixels. That pattern (described by the gray values of the pixels) is referred to as the "point spread function". The point spread function in case of diffraction is different for each wavelength of light. This means that the point spread function will be different in each color channel, so you have treat these separately.

Inverting the unsharpness could be done exactly where it not for the noise. To understand this, consider what the effect of a point spread function is. In the unsharp image, a single pixel is affected by the neighboring pixels in the sharp image with the weights given by the value of the point spread function. Typically the point spread function will fall off quite fast asa function of the distance, so pixels very far away will only make a small contribution. Mathematically, you can write the gray value of the unsharp image at some point x g(x) as:

g(x) = sum over y of h(x-y)p(y)

where the function h gives the gray values of the sharp picture, p is the point spread function. Now, if we take the Fourier transform of both sides then this so-called convolution product becomes an ordinary product, so the recipe to find the sharp image is to take the Fourier transform of the image, divide by the Fourier transform of the point spread function and then take the inverse Fourier transform.

Noise in the unsharp image is going to prevent you from performing exact deconvolution. The Fourier transform of the point spread function will tend to zero for large wavevectors, which means that you are going to divide the Fourier transform of the unsharp image by a small number. Since white noise has a uniform spectrum this means that you are going to greatly amplify the noise present at large wavevectors. Deconvolution algorithms have been developed that deal with this problem, they involve suppressing the high Fourier components using various means.

In practice the best way to go about this is to accurately determine the point spread function. You can e.g. seek out a point source in your image. Then working in a linear colorspace, you split the image in the three color channels, extract the point sources in each channel as your point spread function, run the deconvolution algorithm and and then combine the color channels and transform back to sRGB.

Many deconvolution algorithms work with 32 bit images, the deconvolved images may contain points that have brightnesses that are much larger than the usual maximum 8 or 16 bit value. You should clip these to the maximum value appropriate for the bit depth of the image before converting back to 16 or 8 bit (this may be done automatically when converting back, but some programs may will do this by rescaling turning the image dark).

  • \$\begingroup\$ Is this the best way even if you have more information such as the exact lens model used and its defects as well as information from all the autofocus sensors about subject distance. Would you realy have to find an initial point source given this? \$\endgroup\$
    – lijat
    Jun 14, 2020 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.