如何编程带阻滤波器 [英] How to program a Band-stop filter
问题描述
你好
我有一个图像处理功课,需要帮助
我有一个吵闹的相机男人照片
当我使用fft变换来确切知道噪声的位置我发现它像一个圆圈所以我必须使用带阻滤波器来过滤图像
我在matlab中的代码是:
i = imread('D:/ MY UNIVERSITY / FIFTH / IMAGE PROCESSING / practical / homework / 9.jpg');
i = im2double(i);
i1 = fft2(i);
i2 = fftshift(i1);
figure,imshow(log(1 + abs(i2)),[]);
[x,y] = meshgrid(-128:127,-128:127);
z = sqrt(x。^ 2 + y。^ 2);
c =(z< 30&z> 40);
c1 = fft2(c);
c2 = fftshift(c1);
figure,imshow(log(1 + abs(c2)),[]);
cm = c2。* i2;
cm1 = ifft2(cm) ;
图,imshow(log(1 + abs(cm1)),[]);
但它不起作用,当我展示过滤器照片时,它是完全黑色的,而不是我需要过滤图像
是不是我做了什么
任何帮助都会受到赞赏
hello
I've got an Image processing homework and need help
I've got a noisy camera man photo
when I used fft transform to know exactly where the noise is located I found it like a circle so I have to filter the image using a band-stop filter
my code in matlab is:
i = imread('D:/MY UNIVERSITY/FIFTH/IMAGE PROCESSING/practical/homework/9.jpg');
i=im2double(i);
i1 = fft2(i);
i2 = fftshift(i1);
figure,imshow(log(1+abs(i2)),[]);
[x,y]=meshgrid(-128:127,-128:127);
z=sqrt(x.^2+y.^2);
c = (z<30 & z>40);
c1 = fft2(c);
c2 = fftshift(c1);
figure,imshow(log(1+abs(c2)),[]);
cm = c2.*i2;
cm1=ifft2(cm);
figure,imshow(log(1+abs(cm1)),[]);
but it didn't work, when I showed the filter photo it was totally black and it isn't what I need to filter the image
Is it wrong what I did
any help will be appreciated
推荐答案
最后我已经解决了它
错误是没有理由对过滤器进行傅里叶变换
感谢您给予帮助的时间
finally I've solved it
the error was there is no reason to make fourier transform to the filter
thanks for time you gave to help
这篇关于如何编程带阻滤波器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!