Luc*_*uez 16 matlab design-patterns fft image-processing noise
我正在使用clown.jpg图像来摆脱它所带来的明显模式/噪音.

我在对图像进行FFT之前所做的第一步是将其重新调整为2的幂方形图像(即256 x 256).在matlab中使用FFT和fftshift可以在图像中心的强度下进行快速傅立叶变换.下图是使用前面提到的功能的结果.

通过在FFT图像上手动归零"星形",我成功地消除了模式/噪声,如下所示:

采用IFFT,我得到了更好的图像质量(未显示).
我的问题是,是否有一种将"星星"归零的自动方式?由于我们不想删除最明亮的"星形",DC分量和低值,因此我创建了一个将图像归零的区间.这样的阈值如下:
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.
Run Code Online (Sandbox Code Playgroud)
输出掩码(我将乘以傅立叶图像)如下所示.黑色对应于0的值,白色对应于1.请注意,此蒙版的过滤会删除一些"星星"并保留一些直流分量.显然这种方法不是最好的.

我正在阅读关于做高通滤波器的内容,但这似乎删除了傅立叶图像中的所有外部值.这是基于我之前的测试(我没有包括这些图像).
您是否建议突出显示除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')
Run Code Online (Sandbox Code Playgroud)
我尝试检测频域中的局部最大幅度,并将它们及其邻域归零。它并不完全干净,但至少在某种程度上实现了一些自动归零。
我的代码:
I=I-mean(I(:));
f = fftshift(fft2(I));
fabs=abs(f);
roi=3;thresh=400;
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>400 % periodic noise locates in the position outside the 20-pixel-radius circle
f(r(i)-2:r(i)+2,c(i)-2:c(i)+2)=0; % zero the frequency components
end
end
Inew=ifft2(fftshift(f));
imagesc(real(Inew)),colormap(gray),
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
23077 次 |
| 最近记录: |