Reputation: 1120
In the below image i have computed the Fourier Transform of an image. Now i want to apply ideal high pass filter on same image using DO=50.Code of Fourier Transform is mentioned with in Image.
Upvotes: 0
Views: 1443
Reputation: 250
I don't know what ideal high pass filter. So, I assumed that HPF is a circle-shaped filter. This is my code.
lena = im2double(rgb2gray(imread('lena.bmp')));
D0 = 50;
lpf = zeros(size(lena));
base_x = linspace(-size(lena,1)/2,size(lena,1)/2,size(lena,1));
base_y = linspace(-size(lena,2)/2,size(lena,2)/2,size(lena,2));
[x,y] = meshgrid(base_x, base_y);
lpf(x.^2+y.^2<D0^2) = 1;
hpf = 1-lpf;
LENA = fftshift(fft2(lena));
RESULT = LENA.*hpf;
result = abs(ifft2(RESULT));
figure, imshow(result,[])
First, I make HPF using 1-LPF. (LPF' shape is circle.) And pixel-wise multiply image by HPF. Finally, ifft IMAGE.
When you run the above code, you can obtain this result.
Original Image
HPF Image
Result Image
Upvotes: 1