Tài liệu

# Image processing - Lab 1

Science and Technology

# Problem 1. FFT Analysis

In this laboratory problem, you will learn the MATLAB functions for computing 2D DFT and inverse 2D DFT, and become familiar with basic matrix operations. You will also examine effects occurred to each image as a result of applying different operations in the frequency domain.

You are asked to write a MATLAB program to perform the following tasks for the given test images. (Hint: You may want to consider the following MATLAB functions: imread, imwrite, fft2, ifft2, fftshift, abs and angle)

1. Get the two images: lena.png and beckman.jpg.
2. Zoom in a small part of the image to see the pixels separately.
3. Compute the DFT F(x; y) and display the magnitude and phase of F(x; y)
4. Keep the magnitude of F(x; y) and set the phase to 0 for each frequency sample. Take the inverse DFT, show the result and compare to the original images.
5. Keep the phase of F(x, y) and set the magnitude to unity for each frequency sample. Take the inverse DFT, show the result and compare to the original images
6. Keep the phase of F(x; y ) and replace the magnitude of each frequency sample by it square root. Take the inverse DFT, show the result and compare to the original images. You should observe an edge enhancement.
7. Low-pass filter the test images. First use the rectangular low pass filter
$H\left(x,y\right)=\left\{\begin{array}{cc}1& \mid x\mid <{C}_{x}\text{and}\mid y\mid <{C}_{y}\\ 0& \text{otherwise}\end{array}$

Where ${C}_{x}$and ${C}_{y}$are the cut-off frequencies for x and y respectively. You may want to try fo