Removing periodic noise from an image using the Fourier Transform

72 Ansichten (letzte 30 Tage)
Blob
Blob am 7 Mär. 2023
Bearbeitet: Blob am 7 Mär. 2023
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.
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]);

Antworten (2)

Image Analyst
Image Analyst am 7 Mär. 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:

Blob
Blob am 7 Mär. 2023
Bearbeitet: Blob am 7 Mär. 2023
Here is the image attached, btw where is you demo? @Image Analyst

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by