Introduction
In this project we were supposed to apply various filters to pictures both in the
spatial and in the frequency domain.
The Task

Comments

Original Image

Procesed Image

1.a
Remove the high frequencies in the frequency domain.

How this was done was to first take the FFT of the picture and then
multiply it entrywise by a Gaussian centered at the low frequences (or more
intuitively, located in the middle of the picture after we center
the frequencies using fftshift). This will
effectively attenuate the higher frequencies and will give us the
result that we wanted. Finally, we perform the IFFT on this product
to get back to the spatial domain and to present the picture.

This is the shifted log frequency spectrum of the red channel.

This is the mask that was multiplied by the Fourier
transform of the picture.

1.b
The task was the same as the previous one, but now the filtering had
to be done using convolution in the spatial domain.

I have chosen a Gaussian kernel of small width and performed convolution
using conv2. The reason why this works, is because of the
convolution theorem, that says that if we do a convolution on two
pictures in the spatial domain, the Fourier transform of the result
is equal to multiplying their Fourier transforms. A Gaussian kernel
with small variance has a transform with the reciprocal variance.
So, that is why only the high frequencies will
be filtered. As you can see, there is no difference in the result, except for
the bordering effects because conv2 was used with the second
parameter set to 'same' (i.e. zero padding).



The Task

Comments

Original Image

Procesed Image

2
Sharpen the image using fspecial('unsharp') and imfilter.

The picture was taken from flickr.



The Task

Comments

Original Image

Procesed Image

3
Insert a ghost in the picture.

I inverted the colors in the picture of the ghost and made two copies of that.
One of them was blurred using a Gaussian filter (ala 1.b) and only the
blue channel was preserved to give an auralike effect :). Then, they were
linearly interpolated with the picture of the Ghost Busters to get the final picture.



The Task

Comments

Original Image

Procesed Image

4
Reveal night life in a dark image using histogram equalization or gamma correction.

I present both results, the first one was done using histogram equalization and the second
one using gamma correction with gamma=0.3. The picture was taken from
flickr.



The Task

Original Image

Procesed Image

Extra
In this picture I blur different channels of a colourful picture with the same
Gaussian kernel.

This is the original picture, taken from
flickr.

Red channel blurred.
Green channel blurred.
Blue channel blurred.
