Fourrier Lab Maher Nadar
Fourrier Lab Maher Nadar
In this problem, the objective is to remove periodic noise present in an image by means of the Fourier transform.
We start off with the original image ('moon.jpg'), separately generate a periodic (sinusoidal) noise along the
vertical direction and then merge the two components together to obtain the image with noise:
noise_image = imfuse(I,I2,'blend');
After that, we compute the Fourier transform of the original and the noise image, shift the result to the centre and
display the spectrums in order to visualize (and compare) the frequency representation of the noise.
In the spectrum of the noise image, the task now is to eliminate these bright spots that represent the periodic noise.
We generate a loop that searches for the pixels inside the spectrum that have absolute values beyond 0.6*the
maximum value. These pixels correspond to the same pixels in the Fourier transform that represent the noise, so we
have to eliminate them to enhance the quality of the image. However, we need to read the central bright part of the
frequency in order to keep the high frequencies corresponding to the original image:
% analysing the spectrum and deleting (zeroing) the pixels of the bright
frequencies in the Fourier transform accordingly
for i = 1:size(1)
for j = 1:size(2)
if abs (s2(i,j)) > max(max(abs(s2)))*0.6
f7s(i,j) = 0;
end
end
end
f7s(i,j) = f7s2(i,j);
end
end
Next, we need to invert the shift done in the Fourier transform and invert the Fourier transform itself in order to get
back to the image format and check the result of our cleaning process:
In this problem, the objective is to figure out which part of the frequency transform (magnitude or phase) is the
most dominant or contains most of the information about the image display. In order to do that, we first read two
images ('elephant.jpg') and ('truck.jpg'), and transform them to grey scale. After that, we get their
f2 = fftn(i2);
mag2 = abs(f2);
s2 = log(1+fftshift(f2));
phase2 = angle(f2);
f4 = mag2.*exp(1i*phase1);
mag_truck_phase_elephant = ifft2(f4);
Results:
As we can observe in the last image, the dominant parameter in the Fourier transform is the phase compared to the
magnitude. In fact we can recognise the elephant in the mix where the elephant phase is present, and similarly for
the truck.