Removing periodic noise from an image using the Fourier Transform
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
So I have an image that has horizental lines (noise), in other to get ride of them I worked with the Fourier Transform, however this is the result I get.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1317080/image.gif)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1317080/image.gif)
Here is my code:
im3 = imread('louvreSin.png');
figure, imshow(im3);
frequencyImage = fftshift(fft2(im3));
% Take log magnitude so we can see it better in the display.
amplitudeImage = log(abs(frequencyImage));
minValue = min(min(amplitudeImage))
maxValue = max(max(amplitudeImage))
imshow(amplitudeImage, []);
amplitudeThreshold = 10.9;
brightSpikes = amplitudeImage > amplitudeThreshold; % Binary image.
imshow(brightSpikes);
% Filter/mask the spectrum.
frequencyImage(brightSpikes) = 0;
% Take log magnitude so we can see it better in the display.
amplitudeImage2 = log(abs(frequencyImage));
minValue = min(min(amplitudeImage2))
maxValue = max(max(amplitudeImage2))
imshow(amplitudeImage2, [minValue maxValue]);
filteredImage = ifft2(fftshift(frequencyImage));
amplitudeImage3 = abs(filteredImage);
minValue = min(min(amplitudeImage3))
maxValue = max(max(amplitudeImage3))
imshow(amplitudeImage3, [minValue maxValue]);
0 commentaires
Réponses (2)
Image Analyst
le 7 Mar 2023
An image is generally composed of a lot of energy in the low spatial frequencies and less in the higher frequencies. In the high frequencies you may see spikes that stick up but it's likely your spikes were not higher than the low frequencies. You can't just threshold the image or else you will take out the main part of the signal, like you did, which is why the image is mostly black. You essentially did a low pass filter in addition to any removal of periodic noise spikes. See my attached demo.
Also, attach 'louvreSin.png'.
If you have any more questions, then attach your image and code with the paperclip icon after you read this:
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!