image processing ideal LPF

4 visualizaciones (últimos 30 días)
기조 안
기조 안 el 23 de Nov. de 2023
Respondida: Image Analyst el 23 de Nov. de 2023
I made ideal LPF, but dont know it works well
Plz give me advice
close all;
I = rgb2gray(imread('testa.png'));
M = 512;
I = imresize(I, [M, M]);
[m, n] = size(I);
Ip = uint8(zeros(2*m, 2*n));
Ip(1:m,1:n) = double(I);
F = fft2(Ip);
D0 = round(M/10);
u = 0:2*M-1;
v = 0:2*M-1;
[u, v] = meshgrid(u,v);
D = sqrt( (u-((2*M+1)/2)).^2 + (v-((2*M+1)/2)).^2);
H = double(D <= D0);
G = H.*F;
g = ifft2(G);
subplot(2, 2, 1), imshow(I, []), title('Original Image');
subplot(2, 2, 2), imshow(log(1 + abs(fftshift(F))), []), title('Fourier Transform');
subplot(2, 2, 3), imshow(log(1 + abs((H))), []), title('Low-pass Filter');
subplot(2, 2, 4), imshow(real(g), []), title('Filtered Image');

Respuestas (1)

Image Analyst
Image Analyst el 23 de Nov. de 2023
There is no ideal LPF in general. Maybe there is for your particular image though depending on the high frequency noise in your image. To see how well your script/algorithm works, click the green run triangle. I'm attaching some of my demos for you to compare yours to.
Here's what yours does:
close all;
I = rgb2gray(imread('peppers.png'));
M = 512;
I = imresize(I, [M, M]);
[m, n] = size(I);
Ip = uint8(zeros(2*m, 2*n));
Ip(1:m,1:n) = double(I);
F = fft2(Ip);
D0 = round(M/10);
u = 0:2*M-1;
v = 0:2*M-1;
[u, v] = meshgrid(u,v);
D = sqrt( (u-((2*M+1)/2)).^2 + (v-((2*M+1)/2)).^2);
H = double(D <= D0);
G = H.*F;
g = ifft2(G);
subplot(2, 2, 1), imshow(I, []), title('Original Image');
subplot(2, 2, 2), imshow(log(1 + abs(fftshift(F))), []), title('Fourier Transform');
subplot(2, 2, 3), imshow(log(1 + abs((H))), []), title('Low-pass Filter');
subplot(2, 2, 4), imshow(real(g), []), title('Filtered Image');

Categorías

Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by