Project 2 - Fun with Filters and Frequencies!

By Yiwen Chen

1.1

The partial x and y derivatives are computed by convolving the cameraman image with D_x and D_y respectively.The gradient magnitude is computed by taking the square root of the sum of the partial derivatives squared.Results of partial x and y derivatives and gradient magnitude are shown below (with threshold set to 0.001). However in order to show important edges of the man and the camera, noises in the lake are also reserved.

1.2

Below is the result of applying gaussian filter before taking derivatives. Compared with result without gaussian filter, we can see the noise in the lake is eliminated and we can choose a lower threshold so that edges of cameraman are more clear.

Below are x derivative of gaussian filter, y derivative of gaussian filter and the resulting image. The resulting image is the same as applying gaussian before taking derivatives.

1.3

The rotating angle is chosen by picking the angle that results in highest vetical plus horizontal frequency in the orientation histogram.

Before rotation

After rotating 4 degree

The original image of Pisa Tower

After rotation

Before rotation

After rotation

Failure case: the straigthening process fails because of the stripes on the phone case

After rotation

2.1

We can collect hight frequent part of a image by subtracting the low frequent part from it. By adding these high frequencies to the original image, we can get a sharpened version of the original image. The whole process can be combined into a single convolution operation called the unsharp mask filter

Below is the original taj and sharpend maj.

The original flower image

After blurring the image using a gaussian filter

After shapening the blurred image

2.2

catperson example

Custom image: icecream and Trump

Original icecream and trump with their Fourier transforms

Low pass filtered icecream image and its Fourier transform

High pass filtered trump image and its Fourier transform

Hybrid image and its Fourier transform

Another example: Biden and trump

Original Biden and Trump

Biden Trump hybrid:

2.3

Original Lincoln image

gaussian stack layer 1

gaussian stack layer 2
gaussian stack layer 3
gaussian stack layer 4

laplacian stack layer 1

laplacian stack layer 2
laplacian stack layer 3
laplacian stack layer 4

Another example using the precious catperson image:

gaussian stack layer 1

gaussian stack layer 2
gaussian stack layer 3
gaussian stack layer 4

laplacian stack layer 1

laplacian stack layer 2
laplacian stack layer 3
laplacian stack layer 4

2.4

Original apple and orange

mask:

stack1

stack2
stack3
stack4

We get the final result by combining all stack levels

In [ ]:
Custom example

stack1

stack2
stack3
stack4
In [ ]: