Project 2: Fun with Filters and Frequencies!

1.1 Finite Difference Operator

I first convolved the image with the D_x and D_y kernel to get the gradients in the vertical and hortizontal direction. In order to get the gradient magnitude image, I computed the square root of the sum of squares of the gradients in both directions. I chose a 0.1 threshold for the binarized image.

bears

D_x

bears

D_y

bears

Magnitude

bears

Edge

1.2 Derivative of Gaussian (DoG) Filter

I created a 2D gaussian filter by using cv2.getGaussianKernel() to create a 1D gaussian filter and then taking an outer product with its transpose. Then, I convolved the original image with the 2D gaussian filter to get a blurred image.

bears

Original

bears

Blurred

Then I repeat the steps I did in 1.1 on the blurred image and it appears that the binarized image appears with a lot less noise.

bears

Blurred D_x

bears

Blurred D_y

bears

Blurred Magnitude

bears

Blurred Edge

I then convolve the gaussian filter with the D_x and D_y filter to get these DoG filters.

bears

DoG D_x

bears

DoG D_y

To verify the DoG filters, I convolved them with the image and got the gradient magnitude and binarized images which ends up being the same as convolving the D_x and D_y filter with the blurred image.

bears

DoG D_x

bears

DoG D_y

bears

DoG Magnitude

bears

DoG Edge

2.1 Image "Sharpening"

I subtracted the blurry image from the original image to make a high-pass filter, and add that to the original image to sharpen it.

bears

Original

bears

Sharpened

Another Example

bears

Original

bears

Sharpened

In the images below, I blur an image of Soda and then sharpen the blurred image. However, it still appears more blurry than the original image since high frequency information is still lost.

bears

Original

bears

Blurred

bears

Blurred Sharpened

2.2 Hybrid Images

I created hybrid images by running a low-pass filter on one image and running a high-pass filter on the other image

bears

Derek (Low-pass)

bears

Nutmeg (High-pass)

bears

Hybrid

Fourier Analysis

bears

Aligned Nutmeg

bears

Aligned Derek

bears

Low-pass

bears

High-pass

bears

Hybrid

Other Examples

Denero + Dog.

bears

Denero (Low-pass)

bears

Dog (High-pass)

bears

Hybrid

Bayen + Leopard. This hybrid does not work as well because when you low-pass filter the leopard, you can't really see the spots anymore and Bayen's face contrasts too much with the leopard's body.

bears

Leopard (Low-pass)

bears

Bayen (High-pass)

bears

Hybrid

2.3 Gaussian and Laplacian Stacks

I created the gaussian stack by convolving the image with a gaussian kernel repeatedly. I created the laplacian stack by subtracting the gaussian from the next level of the stack from the current level.

bears

Apple (Level 1)

bears

Orange (Level 1)

bears

Oraple (Level 1)


bears

Apple (Level 2)

bears

Orange (Level 2)

bears

Oraple (Level 2)


bears

Apple (Level 3)

bears

Orange (Level 3)

bears

Oraple (Level 3)


bears

Apple (Level 4)

bears

Orange (Level 4)

bears

Oraple (Level 4)


bears

Apple (Level 5)

bears

Orange (Level 5)

bears

Oraple (Level 5)


bears

Apple

bears

Orange

bears

Oraple

2.4 Multiresolution Blending

In order to blend the images I created a 5-level laplacian stack for each image. Then, I computed each level of a combined laplacian stack with the mask gaussian stack as weights. Finally, I summed up each level to get the blended image.

bears

Apple

bears

Orange

bears

Mask

bears

Oraple


bears

Dock

bears

Space

bears

Mask

bears

Dock to Space


bears

Sahai

bears

Gireeja

bears

Mask

bears

Gireeja Sahai

Gireeja Sahai Stacks

bears

Sahai (Level 1)

bears

Gireeja (Level 1)

bears

Gireeja Sahai (Level 1)


bears

Sahai (Level 2)

bears

Gireeja (Level 2)

bears

Gireeja Sahai (Level 2)


bears

Sahai (Level 3)

bears

Gireeja (Level 3)

bears

Gireeja Sahai (Level 3)


bears

Sahai (Level 4)

bears

Gireeja (Level 4)

bears

Gireeja Sahai (Level 4)


bears

Sahai (Level 5)

bears

Gireeja (Level 5)

bears

Gireeja Sahai (Level 5)


bears

Sahai

bears

Gireeja

bears

Gireeja Sahai