使用傅立叶变换从图像中去除周期性噪声

时间:2017-01-05 19:42:46

标签: matlab image-processing filtering noise noise-reduction

我尝试使用频域技术从图像中去除周期性噪声。因此,我想使用巴特沃斯滤波器。

代码如下:

function main()

img = imread('A1.jpg');
Size = size(img);
red = img(:,:,1); 
green = img(:,:,2);
blue = img(:,:,3); 
redx = done(red,100);
greenx = done(green,100);
bluex = done(blue,100);

LAST = cat(3,redx,greenx,bluex);
showIm(LAST);
figure, imshow(LAST), title('new LAST channel');

end

function Resultx = done(Img,R)

Img = im2double(Img);
Size = size(Img);
Img = fft2(Img);
Img = fftshift(Img);
Result = createHandImg(R,Size, Img);
Result = ifft2(Result);
Result = real(Result);
Resultx = (abs(Result));

end

function Result=createHandImg(r,Size,FourrierImg)

[x,y]=meshgrid(-1*Size(2)/2:Size(2)/2 -1 ,-1 * Size(1)/2:Size(1)/2 - 1);
SqrtArray=1./(1+((x.^2+y.^2)/double(r)).^1);
Tresholded=(SqrtArray<r);
Result =  FourrierImg.* Tresholded ;

end

我的问题是这些代码无法改变嘈杂的图像。换句话说,噪声图像和“清洁”图像几乎相同。即使我更改了阈值,对于我们的示例,它是100,图像只是黑色或与噪声图像相同。这段代码有问题吗?我也尝试高斯滤波器和其他滤波器,但结果总是相同的。您还可以提出其他解决方案(在频域中)以消除周期性噪声。

提前致谢。

0 个答案:

没有答案
相关问题