简体   繁体   中英

Matlab: Remove noisy peaks

I have transformed an image with the help of method fft2 now i want to locate the noisy peaks and erase them as shown in the following image link:

Image with Noisy Peaks

Kindly suggest matlab functionality for achieving this

This is what i did so far

  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

You can try to create a mask of that shows/represents points that exceed certain threshold and position. Let's create arrays of position.

[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;

You should be able to check mask to see if you have located the right positions. imagesc(mask) would be very helpful during your trial-and-error step. Note that I don't have x rules in the example but you could potentially add them if it could help to reduce the search space.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM