Matlab:去除嘈杂的峰值

时间:2013-08-07 13:54:48

标签: fft matlab

我已经在方法fft2的帮助下转换了图像,现在我想找到嘈杂的峰值并将其擦除,如下图所示:

Image with Noisy Peaks

请建议实现此功能的matlab功能

这是我到目前为止所做的事情

  F = fft2(myImage);

  F = fftshift(F); % Center FFT

  F = abs(F); % Get the magnitude
  F = log(F+1); % Use log, for perceptual scaling, and +1 since log(0) is undefined
  F = mat2gray(F); % Use mat2gray to scale the image between 0 and 1

  imshow(F,[]); % Display the result

1 个答案:

答案 0 :(得分:0)

您可以尝试创建一个显示/表示超过特定阈值和位置的点的蒙版。让我们创建位置数组。

[x y] = meshgrid(1:size(a, 2), 1:size(a, 1));  % x-y coordinate of the data
ft = 0.5;                                      % Try different values for your case.
mask = F > ft && y < 0.4*size(a, 1) && y > 0.6*size(a, 1);
F(mask) = 0;

您应该可以查看mask以查看您是否找到了合适的位置。在您的试错过程中,imagesc(mask)会非常有用。请注意,我在示例中没有x规则,但如果它可以帮助减少搜索空间,则可以添加它们。