COMPSCI 194-26: Project 1

Kaijie Xu

nortrom@berkeley.edu

Background

In this project, we manage to do edge detection using finite difference operators with and without gaussian filters. Then, we use the gaussian filters to "sharpen" images and see whether the action could resharpen a blurred image. We also use high pass and low pass filters to overlay two images and create a hybrid image. We then implement Laplacian and Gaussian stacks to analyze the frequency bands of our hybrid images. Finally, we use our Laplacian and Gaussian stacks to implement multiresolution blending of two images.

Part 1.1 : Finite Difference Operator

I calculate the square of the images convolved with Dx and Dy. This results in the x and y-derivatives of the image:

x-derivative                              y-derivative

Then I combine these two images to get the gradient magnitude by summing them up and taking the square root

In other words, the gradient magnitude = (x-derivative^2 + y-derivative^2)^0.5

Here is the result

gradient magnitute

Finally I binarized the image by setting everything above threshold = 15 to 1, with everything below that threshold to 0

binarized gradient magnitude

Part 1.2 : Derivative of Gaussian (DoG) Filter

Method 1: Blur before Convolv

We smooth the image with the low-pass Gaussian filter and then applying the same finite difference operators to the treated images. Here is the result for the same actions in part 1.1

x-derivative                              y-derivative

gradient magnitute

After Blurring the images, we see that the edges are much clearer and there is less noise.

binarized gradient magnitude

Method 2: Convolv before Blur

x-derivative                              y-derivative

gradient magnitute

binarized gradient magnitude

The result is exactly the same as the image from the first method since convolution is commutative and associative.

Part 2.1 : Image Sharpening

I use Gaussian Filter to blur the image, and then use the original image to subtract the blurred image to get the high frequency portion. Then I get the sharpened image by adding the high frequency image to the original image.

In other words: sharp_kernel = (1 + alpha) * Original Image - alpha * Blurred Image

Original Image                              Blurred Image

High Frequency                              Sharpened Image

I also try to blur an image and sharpen it again. However, we can not resharpen the image back to the original image with only the blurred image since we have lost the high frequencies.

Original Image                              Blurred Image

Resharpened Image

Part 2.2 : Hybrid images

Here are my example results by playing around the low and high pass filter sigma values.

The last one fails cuz their different shapes make it hard for us to align and also their base colors have a huge gap

=

Part 2.3 : Gaussian and Laplacian Stacks

By applying Gaussian and Laplacian stacks to the image, we can recreate the low, mid, high frequency parts:

Part 2.4 : Multiresolution Blending

For multiresolution blending, I use the Gaussian stack and Laplacian stack functions in the previous part. For each level of the stack, I multiply the mask with the left image at that level and then multiply (1 - mask) with the right image of that level

Here are the results

Regular Mask

Winter                              Spring

Mirror!

Irregular Mask

Ahri                              Star Sky

Star Ahri!

Akali                              Sussage

Akali The Cook!