CS180 Project 2

Kyle Wong

September 2023

Fun With Filters

Finite Difference Operator

Gradient Magnitude image formula:
Dx = $\begin{bmatrix} 1 & -1 \end{bmatrix}$
Dy = $\begin{bmatrix} 1\\ -1 \end{bmatrix}$
Dx_im = Dx * image
Dy_im = Dy * image
Gradient Magnitude = $\sqrt{Dx\_im ^2 + Dy\_im ^2}$
To calculate the partial derivative in x and y, I convolved the image with finite difference operators Dx and Dy. The Dx operator will do a basic slope calculation between the im[y, x] and im[y, x+1]. The Dy operator will do the same but in the y-axis. Important to note that the Dx will find vertical edges and the Dy will find horizontal edges. The gradient magnitude represents how we want the average of these changes therefore we just do the L_2 Norm of Dx_im and Dy_in. There are many edges in the image, but we want just the prominent ones and not the noisy ones. To find the real edges without noise, I binarized the gradient magnitude by choosing an appropriate threshold.

gradient magnitude thres=0.25
gradient magnitude thres=0.25
gradient magnitude thres=0.25
gradient magnitude thres=0.25

Derivative of Gaussian (DoG) Filter

Differences between 1.1 and 1.2 (Gaussian blurring): In the blurred image, the edges are more prominent and there is less noise in the image. Since the high frequencies have been removed, the threshold value can be reduced since only the most prominent edges remain. In this case it went from 0.25 to 0.03.

The graphs "Blur then Derivative Convolve" and "Single Convolution" look basically the same with the prominent edges showing up in both of them.

single convolution thres=0.25
single convolution thres=0.25
single convolution thres=0.25
single convolution thres=0.25

Fun with Frequencies!

Image "Sharpening"

taj with sharpening
taj with sharpening
lebron with sharpening
lebron with sharpening
blurred kobe with sharpening
blurred kobe with sharpening
blurred kobe with sharpening

Hybrid Images

Hybrid
Hybrid
Hybrid

Failure: I had to bump the cat high frequencies up quite a bit for it to appear on the dog and it made the border appear. I did not know how to get rid of the border.

Hybrid
Hybrid
Hybrid
Hybrid
Hybrid
Hybrid
LF Image Input Low Freq FFT
LF Image Input Low Freq FFT
LF Image Input Low Freq FFT
HF Image Input High Freq FFT
HF Image Input High Freq FFT
HF Image Input High Freq FFT
Hybrid
Hybrid

Gaussian and Laplacian Stacks

image image image image image

image image image image image

image image image image image

image image image image image

LHS+RHS
LHS+RHS
LHS+RHS
LHS+RHS
LHS+RHS
LHS+RHS
LHS+RHS
LHS+RHS
LHS+RHS
LHS+RHS
LHS+RHS
LHS+RHS

Multiresolution Blending

RHS
RHS
Collapsed
Collapsed
Blend In
Blend In
Collapsed
Collapsed

Reflection

This was really cool. I’ve played around with photoshop before, but I never knew it was using a bunch of math. The hard part was finding images that would align correctly.