我正在使用clown.jpg图像,以便能够消除其明显的图案/噪点。
在对图像进行FFT之前,我所采取的第一步是将其重新调整为2的幂的正方形图像(即256 x 256)。在Matlab中使用FFT和fftshift可以得到中心强度的快速傅里叶变换。以下图片是使用上述函数的结果。
通过手动将FFT图像上的“星星”清零,我成功地去除了图案/噪点,如下所示:
通过取IFFT,我得到了更高质量的图片(未显示)。
我想知道是否有自动清零“星星”的方法? 我创建了一个区间来清零图像,因为我们不想去除最亮的“星星”,即直流分量,也不想去除低值。 这样的阈值如下:
filter = (fLog > .7*max(fLog(:)) ) | (fLog < .25*max(fLog(:)) )
where fLog is the log(1+abs(Fourier image)) and .7 and .25 are the corresponding
interval percentages.
下面是输出掩模(我将其乘以傅里叶图像)的内容。黑色对应于值为0,白色对应于1。请注意,此掩模的滤波会去除一些“星星”并保留一些DC分量。显然,这种方法不是最好的。
我正在研究如何进行高通滤波,但似乎会移除傅里叶图像中的所有外部值。这是基于我的先前测试(我没有包含那些图像)。
您是否有建议可以突出高强度值而不包括DC分量?理想情况下,我希望使掩模看起来像:
来源:http://users.accesscomm.ca/bostrum/Imaging/tips/tip1.html
在另一个网站上,提到要使用“高通滤波并校正FFT数据,以仅保留表示光栅图案的散点”。我不清楚如何具体操作。
来源:http://www.robotplanet.dk/graphics/raster_removal/
您的帮助将不胜感激。
以下是我的源代码以供参考:
I = imread('clown.jpg'); % Read Image
% convert to grayscale
I = rgb2gray(I);
% normalize the image and conver to doubleI
I = double(mat2gray(I));
% Resize the image
I = imresize(I, [256 256]);
% get the size of the image
[rows,cols] = size(I);
% apply FFT
f = fftshift(fft2(I));
% used to plot the image
fLog = log(1 + abs(f));
% filter by a range based on fLog
filter = (fLog > .7*max(fLog(:)) ) | (fLog < .25*max(fLog(:)) );
B = abs(ifft2(f.*filter));
colormap(gray)
subplot(2,2,1),imagesc(I); title('Original Image')
subplot(2,2,2),imagesc(fLog); title('Fourier Image')
subplot(2,2,3),imagesc(filter); title('Zeroed Fourier Image')
subplot(2,2,4),imagesc(B); title('Cleaned Image')
annotation('textbox', [0 0.9 1 0.1], ...
'String', 'Fourier Analysis on Clown Image', ...
'EdgeColor', 'none', ...
'HorizontalAlignment', 'center', ...
'FontSize', 15, ...
'FontWeight', 'bold')