我有一个嘈杂的图像,我正在尝试使用低通滤波器进行清理(下面的代码,从here修改)。我得到的图像与我作为输入的图像基本相同。
我不是专家,但我的结论是输入图像太嘈杂,没有找到图案。你同意吗?您对如何解释结果有任何建议吗?
代码结果:
输入图片:
代码:
clear; close all;
frame = 20;
size_y = 512; % This is actually size_x
size_x = 256; % This is actually size_y
roi=5;thresh=100000;
AA = imread('image.png');
A = zeros(size_x, size_y);
A = AA(1:size_x, 1:size_y);
A(isnan(A)) = 0 ;
B = fftshift(fft2(A));
fabs = abs(B);
figure; imshow(B);
local_extr = ordfilt2(fabs, roi^2, ones(roi)); % find local maximum within 3*3 range
result = (fabs == local_extr) & (fabs > thresh);
[r, c] = find(result);
for i=1:length(r)
if (r(i)-128)^2+(c(i)-128)^2>thresh % periodic noise locates in the position outside the 20-pixel-radius circle
B(r(i)-2:r(i)+2,c(i)-2:c(i)+2)=0; % zero the frequency components
end
end
Inew=ifft2(fftshift(B));
figure;
subplot(2,1,1); imagesc(A), colormap(gray); title('Original image');
subplot(2,1,2);imagesc(real(Inew)),colormap(gray); title('Filtered image');
答案 0 :(得分:2)
对于过滤此类信号,您可以尝试使用中值滤波器。它可能比手段或高斯滤波器更合适。中值滤波器对盐和纸张非常有效"当平均值只是模糊噪音时噪音。
由于信号看起来非常嘈杂,您需要尝试为滤波器找到良好的内核大小。您还可以尝试增加图像的对比度(过滤后),以便更多地看到灰度级别之间的差异。