filtering using FFT in images
33 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I am experimenting with masking out areas on a FFT of an image to see the effect on the processed image:
After reading, I have the following.
I=I-mean(I(:));
f = fftshift(fft2(I));
fabs=abs(f);
figure
subplot(1,3,1)
imshow(fabs,[])
After viewing the FFT, I notice there are some white spots, so to attempt to remove these, I have defined a threshold of 90% of the max. My aim is to remove these from the fabs image and then inverse fft and then view this processed image.
thresh=0.9*max(fabs(:))
Im not too sure how to apply the the threshold to the frequency domain image and then iFFT back.
0 commentaires
Réponse acceptée
Image Analyst
le 26 Oct 2015
Try this:
% Find pixels that are brighter than the threshold.
mask = fabs > thresh;
% Erase those from the image
fabs(mask) = 0;
% Shift back and inverse fft
filteredImage = ifft2(fftshift(fabs)) + mean2(I);
imshow(filteredImage, []);
12 commentaires
Image Analyst
le 29 Oct 2015
What do you want to do? The spikes and bars in the spectrum represent periodic structures in the spatial domain. If you get rid of those spikes, you should reduce the periodic patterns in the spatial domain.
They're inversely related. Fast changing spatial bars give rise to widely spaced spikes in the Fourier spectrum and vice versa. So the 4 big spikes you see are related to the sine wave pattern on the white rectangles. The other stuff is a 2D sinc due to there being a couple of bright squares in the image. The big spike at 0, the "DC spike" is due to the fact that the image has a non-zero mean gray level.
Plus de réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

