フィルターのクリア

low pass filter for image analysis

5 ビュー (過去 30 日間)
Snowleopard
Snowleopard 2016 年 9 月 16 日
コメント済み: Snowleopard 2016 年 9 月 24 日
I am doing low pass filtering of an image.After applying mask and I need to get filtered image but instead I am getting I6 as attached. I have tried with different mask sizes but still unable to get the same image back with low frequency content. Can you plz check the code and point the mistake in code or methodology.
Thanks in advance,
if true
% code
clc
close all
clear all
I1 = imread('C:\User\Desktop\taken\s3.jpg');
I1 = imresize(I1,[128 128]);
I2 = rgb2gray(I1)
I2=double(I2);
figure, imshow(uint8(I2));
I3=fft2(I2);
I3=fftshift(I3);
figure
I4=log(1+abs(I3));
imshow(mat2gray(I4));
[r,c]=size(I2);
orgr=r/2;
orgc=c/2;
mf= zeros(r,c);
D0= 40;
for i=1:r
for j=1:c
if((i-orgr)^2+(j-orgc)^2)^(0.5)<=D0
mf(i,j)=1;
end
end
end
figure
imshow(uint8(255*mf));
title('frequency domain filter used');
I5=I3*mf;
figure,
I4=log(1+abs(I5));
imshow(mat2gray(I4));
title('filtered image in frequency domain');
I6=ifft2(ifftshift(I5));
figure,
imshow(uint8(abs(I6)));
title('filtered gray scale image');
end

採用された回答

Jordan Ross
Jordan Ross 2016 年 9 月 23 日
Hi,
It seems you have an error in your code. The following line:
I5=I3*mf;
Should be:
I5=I3.*mf;
After making this change I was able to retrieve the image back (see the attached file).
  1 件のコメント
Snowleopard
Snowleopard 2016 年 9 月 24 日
Thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by