CS 194-26 Project 2: Fun with filters and frequencies

By Eric Li

Part 1.1: Finite Difference Operator

The goal of this part of the project was to filter our cameraman photo with a simple convolution to find the derivative map of the images (edges). To do this, I first converted [1, -1] and [1, -1] transposed into numpy arrays as my dX and dY. I then used the convolve2d function to find the partial derivative gradient with respect to x and y. I found the magnitude of both partial derivative gradients using the built in absolute value function in python, and then filtered their summation. Through experimentation, I found that filtering by .19 produced a good edge map. Meaning, magnitudes greater than .19 were set to 1 and all others 0.

Part 1.2: Derivative of Gaussian (DoG) Filter

The differences I see between using a 2d gaussian and the 1.1 approach is that our edges are much stronger and there is less high frequency noise in the final gradient. This makes sense since the Gaussian is a low-pass filter. Regardless of using a single or multiple convolutions, the resulting gradients is the same. Below I have shared the final edge gradients after filtering by a threshold of .08, much lower compared to our last one in 1.1.

| one convolution | two convolution

Part 1.3: Image Straightening

Results below, showing in order of original, rotated, and histograms

Facade, sucess, original and rotated

| original| rotated

Facade distribution of angles before and after rotation, respectively

| original| rotated

Tilted Woman, sucess, original and rotated

| original| rotated

Facade distribution of angles before and after rotation, respectively

| original| rotated

Grid, partial failure/success, original and rotated. The algo rotated it the right direction but not to a high enough magnitude.

| original| rotated

Facade distribution of angles before and after rotation, respectively

| original| rotated

Grid, total failure, original and rotated. Unlike our other failure, this time the algo rotated too a high enough magnitude. Likely due to noise from colors in the sky.

| original| rotated

Facade distribution of angles before and after rotation, respectively

| original| rotated

Part 2.1: Image "Sharpening"

Taj unsharp and sharp

ESO game art unsharp and sharp

Crab in bottle unsharp and sharp

Julio Jones the GOAT unsharp and sharp

Julio Jones the GOAT original, blurry, then sharpened on the blurry version

Sharpening the blurry version of the photo lost some details due to the gaussian. Since the process of blurring the photo removes the high frequences, it is expected we lose some details if we blur then sharpen. Some things I noticed is that the color is drastically darker and birght colors were dulled the most, as seen in Julio's uniform. This makes sense since they were likely high frequency signals.

Part 2.2: Hybrid Images

To complete this part of the project, I used the summation of the output of a high pass and a low pass filter on two images. For my low pass filters, I has a simga of 10 and size 51. For the high pass, I used a sigma of 1 with a size of 51. I also scaled high frequency results by a factor of 3 to make them stand out more.

Derek and Nutmeg

Michael Scott-ception

Failure: house before and after. I believe this failed since I did not incorporate color well enough, making the high frequencies indistiguishable from the low frequency frame.

Failure: batman. The alignment does not work well - batman is very very tiny. This goes to show the importance of finding similar size images - ben affleck is much higher res.

Example with fourier analysis: Johnny Depp.

Young Johnny

original with fourier low pass with fourier

Old Johnny

original with fourier high pass with fourier

Hybrid

hybrid with fourier

Part 2.3: Gaussian and Laplacian Stacks

Results for my gaussian and laplacian stacks on the lincolns photo and my Johnny Depp hybrid.

Lincoln: Gaussian

1 2 3 4 5

Lincoln: Laplacian

1 2 3 4 5

Depp: Gaussian

1 2 3 4 5

Depp: Laplacian

1 2 3 4 5

Part 2.4: Multiresolution Blending (a.k.a. the oraple!)

The Oraple

Merging Chess Pieces

Total

queen

1 2 3 45

pawn

1 2 3 45

created this which attempting to merge the oraple. Thought I'd share it.