image processing ideal LPF

조회 수: 6 (최근 30일)
기조 안
기조 안 2023년 11월 23일
답변: Image Analyst 2023년 11월 23일
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');

답변 (1개)

Image Analyst
Image Analyst 2023년 11월 23일
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');

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by