Skip to content

This Matlab code will denoise the periodic noise present in a given image file. Here I have used the fast Fourier transformation method to convert the image to the Fourier domain. now the noise can be detected in the Fourier plot by finding bright spots.

License

Notifications You must be signed in to change notification settings

Amagnum/Denoising-Images-with-FFT-Matlab

Repository files navigation

Denoising Images with FFT Matlab

This Matlab code will denoise the periodic noise present in a given image file.

Here I have used the fast Fourier transformation method to convert the image to the Fourier domain. now the noise can be detected in the Fourier plot by finding bright spots.

A fast Fourier transform (FFT) is an algorithm that computes the discrete Fourier transform (DFT) of a sequence, or its inverse (IDFT). Fourier analysis converts a signal from its original domain (often time or space) to a representation in the frequency domain and vice versa. (Wikipedia)

Note that: This program can be used for removing/denoising a periodic noise from a given image file.

Let’s see how:

alt_text alt_text
Cameraman.tif FFT plot of Cameraman.tif

create periodic noise:

img_test = 35*ones(256,256);
for i = 1:16:size(img_test,2)
img_test(:,i:i+7) = -35;
end
figure, imshow(img_test);
test_ft = fft2(img_test);
figure, imshow(log(1+fftshift(test_ft)));
alt_text alt_text
periodic noise FFT of periodic noise

Add periodic noise to the image:

img_n = double(img1) + img_test;
figure, imshow(img_n,[]);
alt_text alt_text
Adding noise to Cameraman.tif FFT of new Image

Note: here if you can notice, the bright spots in FFT of the new image (same in the FFT of periodic noise), now if somehow we can remove those spots, we can denoise the image.

From this point, we only work with the newly generated image (noisy one)

Implimenting the threshold function:

Let’s write a function to calculate the intensities greater than a particular threshold in the FFT of the new image. We set

Threshold = Max( Magnitude ( FFT_New_Image ) ) / 30

alt_text alt_text
Applying the threshold function, and generating a binary matrix (Image) skipping the centre part, we almost get the FFT of noise.

Results:

alt_text alt_text
Replacing the Bright spots by an average value in its neighbourhood. Take inverse FFT and generate the image back!

About

This Matlab code will denoise the periodic noise present in a given image file. Here I have used the fast Fourier transformation method to convert the image to the Fourier domain. now the noise can be detected in the Fourier plot by finding bright spots.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages