image processing ideal LPF

4 ビュー (過去 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 Center および File ExchangeRead, 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