I have an assignment to filter in the frequency domain. It gives me various filters to use in part of the question but I am just trying to figure out how to add even one. I'm still learning Matlab and image processing in general.
Assignment Question: Use index2gray to convert “tees.tif” to gray level image. Filter the gray level image in the frequency domain using 2D fft (fft2), after performing the operation you can use 2D ifft (ifft2) to display the filtered image in the spatial domain for:
a- Rectangular low pass filter using cutoff frequency of (uc=N/8,vc=M/8) where N and M are the row and column sizes of the image.
My Current code is:
[I,cmap] = imread('trees.tif');
img = ind2gray(I,cmap);
[rows columns] = size(img);
imshow(img);
fftO = fft2(double(img));
shifted = fftshift(fftO);
logged = log(1+abs(shifted));
imshow(logged,[]);
If I understand this correctly, I have the grey level image in the frequency domain and now need to filter it. I'm confused about the filtering part. I need to make a rectangular low pass filter using cutoff frequencies. How do I go about adding cutoff frequencies? I assume I will be using a Gaussian or Butterworth filter and have the filter size be equal to the image.
After I figure out this filter thing, I should be able to do (H is filter)
filtered = logged.*H;
invert = real(ifft2(filtered));
imshow(invert);
Anyone know how I need to proceed with the filter section?