You are on page 1of 5

Image processing Homework

Name: Zedan Saeed Murad


Q1//// When applying Fourier transforms zero
padding is very important. Assume image f(x,y)
and filter h(x,y) of sizes A × B and C × D
respectively( in most cases A>>C and B>>D).
Write down the Basic Steps in Frequency
Domain Filtering.
Answer:
The following summarize the basic steps in DFT Filtering
Assume images f(x,y) and h(x,y) of sizes A × B and C × D
respectively (in most cases A>>C and B>>D).
1- Obtain the size of zero’s padding
For P (A + C – 1) and for Q (B + D – 1)
2- Obtain the Fourier transform of the image with padding:
F= fft2(f, P, Q)
3- Generate a filter function, H, the same size as the image
4- Multiply the transformed image by the filter:
G=H.*F;
5- Obtain the real part of the inverse FFT of G:
g=real(ifft2(G));
6- Crop the top, left rectangle to the original size:
gc=g (C-1: A, D-1: B);
Mat lab code
Q2/// Explain the image morphological dilation
and erosion operations.
Solution: In the morphological dilation and erosion
operations, the state of any given pixel in the output image is
determined by applying a rule to the corresponding pixel and
its neighbors in the input image. The rule used to process the
pixels defines the operation as a dilation or an erosion. This
table lists the rules for both dilation and erosion.

Operation Rule

Dilation The value of the output pixel is the maximum value of all the
pixels in the input pixel's neighborhood. In a binary image, if
any of the pixels is set to the value 1, the output pixel is set to
1.

Erosion The value of the output pixel is the minimum value of all the
pixels in the input pixel's neighborhood. In a binary image, if
any of the pixels is set to 0, the output pixel is set to 0.
Dilation process:

Erosion process:

You might also like