CS194-26, Fall 2021

Programming Project 2

Jaeyoung Park



Part 1. Fun with Filters

1.1. Finite Difference Operator

Firstly, I computed partial derivative of image with respect to x and y by convolving it with x and y filter. Then, I computed sum of squares of two partial dericative (dx, dy), which is im_dx**2 + im_dy**2. After that, gradient descent was computed by taking square root of it. Finally, I binarized the gradient descent to make edge detection easier. Threshold for binarzing was 0.25



Partial derivative of image (dx)

Partial derivative of image (dy)

Gradient Magnitude of image

Binarized Graident Magnitude of image



1.2. Derivative of Gaussian (DoG) Filter

In this part, we will convolve the image first by with gaussian filter. This will blur the image, and therefore can reduce noise in binarized gradient magnitude.



Blurred Cameraman Image

Partial derivative of blurred image (dx)

Partial derivative of blurred image (dy)

Gradient Magnitude

Binarized Graident Magnitude

What differences do you see?

Since image is blurred by convolving with gaussian filter, Binarized gradient magnitude of blurred image contains much less noise than previous one.

Verify that you get the same result as before.

Now, we take a partial derivative of gaussian filter with respect to x and y first.

Then, we convolved derivative of gaussian filter with original image (not blurred).

Partial derivative of gaussian filter (dx)

Partial derivative of gaussian filter (dy)

Convolution of original image and dx of gaussian filter

Convolution of original image and dy of gaussian filter

Gradient Magnitude

Binarized Graident Magnitude

Single convolution and double convolution gave us same result.



Part 2. Fun with Frequencies!

2.1. Image "Sharpening"

2.1.1. Taj Sharpening

Original

Blurred

Sharpened



2.1.2. Tiger Sharpening

Original

Blurred

Sharpened

From this tiger image, we can see that sharpened tiger has more clear eyebrows ans whisker.



2.2. Hybrid Images

2.2.1. Cat and Derek

Aligned_cat

Aligned_derek

High-Pass

Low-Pass

Hybrid



2.2.2. Human and Samoyed

Aligned_human

Aligned_samoyed

High-Pass

Low-Pass

Hybrid

I tried with several sigma values for high pass and low pass filter. For both filters, kernel size was 3*sigma. As I increased sigma value for high pass filter, high pass filtered image became more clear as shown below.

Sigma: 1

Sigma: 5

For low pass filter, as I increased sigma value, low pass filtered image became more blurred as shown below.

Sigma: 1

Sigma: 10

Even though I blurred samoyed image with high sigma value, black nose and mouth of samoyed did not get lighter. Hence, in the hybrid image, we can still see black nose and mouth of samoyed from a close distance.

Fourier Analysis for Human and Samoyed

Human Fourier

Samoyed Fourier

High Pass Human Fourier

Low Pass Samoyed Fourier

Hybrid Fourier



2.2.3. Lion and Woman

Aligned_lion

Aligned_woman

High-Pass

Low-Pass

Hybrid

Fourier Analysis for Lion and Woman

Lion Fourier

Woman Fourier

High Pass Lion Fourier

Low Pass Woman Fourier

Hybrid Fourier



2.3. Gaussian and Laplacian Stacks



Gaussian and Laplacian stack of apple and orange

gaussian stack for apple

depth0

depth1

depth2

depth3

depth4

laplacian stack for apple

depth0

depth1

depth2

depth3

depth4

gaussian stack for orange

depth0

depth1

depth2

depth3

depth4

laplacian stack for orange

depth0

depth1

depth2

depth3

depth4



Blending details for each level

depth 0



depth 2



depth 4



final result



2.4. Multiresolution Blending



2.4.1. Orapple

gray

colored



2.4.2. Bulk

Original images

Banner

Hulk



Blended image



Mask



Blending details for each level

depth 0


depth 1


depth 2


depth 3


depth 4


final result




2.4.3. Rona1d0

Original images

Rooney

Ronaldo



Blended image (Ronaldo with jersey number 10)



Mask



Blending details for each level

depth 0


depth 1


depth 2


depth 3


depth 4


final result




What I learned from this project

This project was really fun. Out of many parts, I enjoyed hybrid image and multiresolution blending the most. It was interesting to learn that we can see low frequency image from long distance. Making a hybrid image with two images that I chose was really fun. Also, for multireolution blending, it was cool to blend two images without using photoshop. Out of three images that I blended, I liked rona1d0 (Cristiano Ronaldo with jersey number 10) the most.





Image Credit

tiger:https://psprices.com/region-pt/game/2604569/minefield-angry-tiger-face-gamer-avatar

human:https://kottke.org/18/12/ai-generated-human-faces-that-look-amazingly-real

samoyed:https://pixels.com/featured/portrait-of-samoyed-dog-on-white-background-sergey-taran.html

lion:https://www.redbubble.com/i/art-board-print/Lion-face-by-Wallfower/36562357.JUXJO

woman:https://dc-dermdocs.com/human-face-and-golden-ratio/

banner:https://twitter.com/rbbhulk

hulk:https://wallpapersafari.com/w/aR06SF

rooney:https://www.besoccer.com/new/watch-rooney-shirt-swap-rejected-on-pitch-by-ex-man-city-player

ronaldo:https://www.independent.co.uk/sport/football/cristiano-ronaldo-shirt-number-manchester-united-b1913375.html