## CSC 249/449 Computer Vision: Fourier Filtering Assignment

Weighting factor 4.

Using the Fourier transform facilities in MatLab, (or GSL, or other favorite source if you prefer) attempt to deblur an image using frequency-domain techniques. More specifically, by defocusing the lens of a camera, take one or more blurred images. Then, without changing the focus or aperture of the camera, take a picture of a point source of light in order to find the point-spread function (psf) of your camera/lens system. It may take some imagination to do this so that the image is neither over- nor under-exposed, contains no background, and so that the "point" has no structure of its own (i.e. is much smaller than the blur). An alternative to using the blurred point image values directly, is to use them to determine the parameters of an analytic model of the point spread function. For example, you might model the psf of a defocused lens as a uniform disk and use the image to determine its diameter. The advantage of this is you avoid problems with image noise and background. The disadvantage is that there might be important details of the actual psf that are not captured by the parameteric model you are using.

Use this point-spread function to design a matched filter in the Fourier domain that will sharpen your blurred images. The Weiner filter approach is one method that can give good results, but it is not the only one, and it requires estimating additional parameters of the noise function. When you consider deblurring techniques, remember that dividing by zero or anything close to it will give a result consisting of noise. You will have to experiment to find out what "close to zero" is (can you predict it analytically??) A lot of what high frequency energy there is in ordinary images is due to pixel noise, and you need to avoid amplifying it. How to fill in the blank areas (near the zeros of the transformed point spread function) is up to you. As mentioned above, the Weiner filter is one method. The quality of your result depends largely on how you do this and what you decide is "close to zero". Whatever approach you take, I want you to manipulate the raw images and Fourier transforms and implement the filtering yourself. This means that using a prepackaged Weiner filter is not an acceptable approach (except possibly for purposes of evaluating your implementation).

Hand in copies of your original and restored images, a picture of the point spread function and its power spectrum, and a careful writeup of what you did. It might be interesting to compare your results with a generic "sharpening" algorithm (such as the ones in photoshop, gimp, or other image processing softwares suites). You should be able to do at least as well as that.

Hints:

• Look at the power spectra of your transformed images to make sure they look right.

• Make sure your images are scaled correctly for viewing when you look at them.

• Since your point-spread function is likely symmetric (in fact circular) to a first approximation, you may be able to ignore the phase part of the transformed images and deal only with the power spectra (as long as you keep the phase of the original image for reconstruction)

• Don't underestimate how large "zero" may be. Remember, the values in the transform are obtained from weighted sums of all the pixels in the original image, with weights between +1 and -1. There may even be some advantage to making your "zero range" a function of frequency (This is essentially what the Weiner filter does).

• One trick for getting at "zero" or other properties of the noise signal is taking the transform of one or more "blank" images (e.g. pictures of black or white scenes). Since such images contain noise typical of your overall setup, you can use them to estimate what the noise is in the Fourier domain, and hence what is distinguishable from zero.

• With only 8 bits per pixel, there is a limit to how much blurring you can undo. (Can you figure out how to predict analytically how much given the noise characteristics of your image?) If you can't seem to improve things much, try a smaller blur radius. You could also try to get more effective bits per pixel by taking multiple images and adding them up. This does not work quite as well as one might first guess - adding two 8-bit images does not give you a 9-bit image as far as noise is concerned, but the sqrt(n) increase in the signal-to-noise ratio does add up eventually. For example, with 16 independent images, the s/n ratio increases by a factor of sqrt(16) = 4, or two bits more than whatever you started with.
Section 4.4 in Sonka et al. (the text) has some information on image retoration that may be useful.