CS194-26 Project 2

Yusuf Ahmad

Part 1.1:

We can calculate the derivative of an image by convolving our image with the finite difference operator of the respective x and y directions. We can also outline the edges of the pictures by finding the magnitude of the image in the x and y directions (sqrt(Dx^2 + Dy^2)). Additionally, in order to filter out noise, we can binarize the magnitude image by adding a threshold for which edges will not be filtered out to find the main focus of the pictures.

Dx of image

Dy of image

Magnitude of image

Magnitude threshold = 0.05

Magnitude threshold = 0.1

Magnitude threshold = 0.15

Magnitude threshold = 0.2

Magnitude threshold = 0.25

Part 1.2:

Since simply taking the derivative doesn't account for the noise in the image, what we can do is convolve the image with a gaussian to smooth out the high frequencies of the image, and then perform our derivative and magnitude calculations. This results in smoother edges being detected with more noise filtered out. Additionally, instead of convolving and then taking the derivative of every picture we would want to edge detect, we can take the derivative of the gaussian filter by convoling the finite difference operators and the gaussian filter and simply convolve every image with that.

DoGx

DoGy

DoG Magnitude

DoG Magnitude Threshold = 0.05

DoG Magnitude Threshold = 0.1

DoG Magnitude Threshold = 0.15

DoG Magnitude Threshold = 0.2

DoG Magnitude Threshold = 0.25

 

The best threshold seems to be around 0.1

Part 2.1:

To sharpen an image, we want to increase the high frequencies of the image. We obtain these by blurring the original image through convolution and subtracting the blurry image from the original image. We then add the high frequencies to the original image to make it sharper. We can also achieve this more quickly through the unsharp mask technique which follows the formula f * ((1 + a)e - ag)

Original image

Blurred image

a = 0.5

a = 1

a = 2

a = 5

a = 10

Original image

Blurred image

a = 0.5

a = 1

a = 2

a = 5

a = 10

Part 2.2:

To create hybrid images, we obtain the low frequencies of one image and stack them on the high frequences of another through low and high pass filters respectively.

Hybrid image of Derek and Nutmeg

Hybrid image with color in both high and low frequencies

Hybrid image of Daniel Radcliffe and Rupert Grint

Hybrid image of Loki and Thor

Derek FFT

Nutmeg FFT

Hybrid Image FFT

Low Pass Filter FFT

High Pass Filter FFT

 

Part 2.3:

5th layer of laplacian stack

4th layer of laplacian stack

3rd layer of laplacian stack

2nd layer of laplacian stack

1st layer of laplacian stack

Part 2.4:

To blend to images, we create a gaussian and laplacian stack for each image and mask opposite sides of each image. We take the mean of the resulting layers to obtain a blended image

Blended orple