image processing ideal LPF
조회 수: 6 (최근 30일)
이전 댓글 표시
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');
댓글 수: 0
답변 (1개)
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');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File 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!
