SD 575 Lab 3: Filter Design and Image Restoration in Frequency Domain solution

$24.99

Original Work ?
Category: Tags: , , , , You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (4 votes)

1 Overview
The goal of this lab is to study Fourier analysis and provide some hands-on experience with image restoration
concepts in frequency domain as well as filter design.
The following images will be used for testing purposes:
• mandrill.png
• cameraman.tif
• frequnoisy.tif
The first two images are included with Matlab. The other images are available at the course website.
2 Fourier Analysis
Let us now study the characteristics of an image in frequency domain. For this study, we will create a new
256×256 test image, which consists of a white rectangle.
f = zeros(256,256);
f(:,108:148)=1;
Plot the test image. Now plot the Fourier spectra of the image. Be sure to use the [] argument in the imshow
function to rescale the Fourier spectra to the full dynamic range. The ff t2, ff tshif t, and abs functions
will be useful here.
1. What can you say about the general distribution of energy in the Fourier spectra? Why?
1
2. What characteristics about the test image can you infer from the Fourier spectra?
Now rotate the test image by 45 degrees and plot both the Fourier spectra and the image. The imrotate
function will be useful here.
1. How did the Fourier spectra change from the original image (before rotation)?
2. What conclusions and observations can be made about image characteristics based on the Fourier
spectra of both original image and the rotated image?
Now let us study the contribution of Fourier amplitude and phase to the underlying image. Load the mandrill
image and convert it to a grayscale image using the rgb2gray function. Now compute the amplitude and
phase of the mandrill image. Remember that the amplitude component A is the magnitude of the Fourier
complex component (use the abs function) and the phase component θ can be found by simply dividing the
Fourier component F(w) by the amplitude A since
F(w) = A ∗ (cos(θ) + j sin(θ)) (1)
Now perform the inverse Fourier transform on the amplitude component A and the phase component θ
separately. Plot the original image, the reconstructed image using just the amplitude component, and the
reconstructed image using just the phase component.
1. Describe how the reconstructed image from the amplitude component look like? What image characteristics does the amplitude component capture?
2. Describe how the reconstructed image from the phase component look like? What image characteristics does the phase component capture?
3 Noise Reduction in the Frequency Domain
Let us now study noise reduction techniques based on frequency domain filtering as well as the effect of
filter parameters on image quality. Load the mandrill image (adjust intensities to range of 0 to 1) and apply
additive Gaussian noise with variance of 0.005 to the image. Plot the Log Fourier spectra of the original
image and the noisy image by using the log function on the Fourier spectra.
1. Compare the two Fourier spectra. What are the differences? Where is these differences most visually
prominent? Why?
Now let us study the ideal low-pass filter. To create an ideal low-pass filter with a cut-off radius r, first you
need to create an image of a white circle with radius r. One approach to do use the fspecial function in the
following way:
2
h = fspecial(’disk’,r); h(h > 0)=1;
Now create a black image (representing an energy-less Fourier spectra) and center the circle onto the black
image:
h freq = zeros([height of image],[width of image]);
h freq([[height of image]/2-r:[height of image]/2+r],[[width of image]/2-r:[width of image]/2+r])=h;
Create and plot the Fourier spectra of the resulting low-pass filter h freq with a radius of 60. Now, apply
the filter on the noisy image in the frequency domain and then perform an inverse Fourier transform. iff t2
and iff tshif t will come in handy. Plot the resulting denoised image and the corresponding PSNR.
1. Describe the appearance of the denoised image compared to the original and the noisy images. Why
does it look this way? What does the ideal low-pass filter do?
2. There is a particular artifact present in the restored image. What is it and why does it happen?
Now create a low-pass filter with a cut-off radius of 20 and apply it to the noisy image in the frequency
domain and then perform an inverse Fourier transform. Plot the resulting denoised image and the corresponding PSNR.
1. Compare the denoised image with the denoised image using a cut-off radius of 60. How does the
image and the PSNR differ? Why?
2. What conclusions can you draw about the relationship between cut-off radius and resulting image
after filtering? What is the trade-off in terms of noise reduction?
Now let’s do the same thing with a Gaussian low-pass filter. Create a Gaussian low-pass filter kernel with a
standard deviation of 60 and normalize it based on the highest value in the kernel. max and
functions will come in handy. Apply the Gaussian low-pass filter to the noisy image in the frequency domain
and then perform an inverse Fourier transform. Plot the resulting denoised image and the corresponding
PSNR.
1. Compare the denoised image with the denoised images produced using the ideal low-pass filters. How
does the image and the PSNR differ? Is it better or worse? Why? Does it have the same type of image
artifacts?
4 Filter Design
Examine the image frequnoisy.tif and its Fourier spectrum. Note the peaks in the spectrum corresponding to
the periodic noise source, which has been added to the original image. Design and implement a frequency
domain filter which filters out this noise. Justify your design.
3
5 Report
Include in your report:
• A brief introduction.
• Pertinent graphs and images (properly labelled).
• Include code (can be included in appendix).
• Include responses to all questions.
• A brief summary of your results with conclusions.
4