Project 2: Fun with Filters and Frequencies! Lizhi(Gary) Yang

Part 1: Fun with Filters

Part 1.1: Finite Difference Operator

I computed the gradient magnitude by computing the partial derivative of x and the partial derivative of y using scipy.signal.conv2d with D_x and D_y seperately, and then summing their squares up and taking the square root. Here are the images:

partial derivative of x  partial derivative of y
            partial derivative of x                       partial derivative of y

gradient magnitude  edge
            gradient magnitude                                         edge

Part 1.2: Derivative of Gaussian (DoG) Filter

After applying the Gaussian filter, the difference that I noticed is that there is much less noise, here is an comparison under the same threhold of 25:
with gaussian filter  without gaussian filter
              with gaussian filter                         without gaussian filter
Here are the two one-step DoG filters for D_x and D_y respectively:
DoG for D_x  DoG for D_y
                    DoG for D_x                                       DoG for D_y
Here are the two edge images, all threholded at 25:
2-step  1-step
                    2 step filter                                         1 step filter
Here is the proof that they are the same, g_edge is the 2 step filter one and gk_edge is the one step filter one:
same

Part 1.3: Image Straightening

From left to right are the original, straightened, and histogram

Here is the prvided image:

original  straight  hist

Here are the 3 of my choice:

original  straight  hist
Above is the one that failed since I was intending to let the billboard straighten, but it seems the high frequency backgroud edges were dominating the gradients

These are the ones that worked
original  straight  hist
original  straight  hist
original  straight  hist

Part 2: Fun with Frequencies!

Part 2.1: Image "Sharpening"

Here is the provided image:
original  sharp
                    original                                             sharpened
Here are some own examples:
original  sharp
                    original                                             sharpened
original  sharp
                    original                                             sharpened
Here is a sharp image bourred and then sharpened again:
original  sharp   sharp
                                    original                                                                                 blurred                                                                             sharpened
I noticed that there is high frequency noise in the re-sharpened image, since when blurring we lost the original high-frequency information, and the resharpening could not recover it.

Part 2.2: Hybrid Images

Here are the images, the first one with its accompanying FFT graphs:
input1  input2  merged 
                        input for low pass                                                 input for high pass                                                             result
input1-fft  input2-fft 
                        FFT for low pass input                                         FFT for high pass input
gaussian-fft  lap-fft 
                      FFT for after low pass                                             FFT for after high pass
original
                          FFT after merge
Here are some more images:

input1  input2  merged 
                        input for low pass                         input for high pass                       result

Here is one failed example: The fence frequency is obstructing the merge
input1  input2  merged 
  input for low pass                             input for high pass                                             result

Part 2.3: Gaussian and Laplacian Stacks

Here are the guassian and laplacian stacks for the Lincoln image (the laplacian stack is normalized to make viewability better):
original-lincoln 
  original image
gaussian-stack-lincoln 
                                  gaussian stack
laplacian-stack-lincoln 
                                  laplacian stack
Here are the stacks for the hybrid image:
hybrid 
        original image
gaussian-stack-hybrid 
                                  gaussian stack
laplacian-stack-hybrid 
                                  laplacian stack

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

For this part I incorporated also bells and whisltes as my implementation supports color images.
Here is the oraple:
apple  orange  mask  orapple 
                        apple                                                 orange                                                 mask                                                 orapple
Here are the laplacian stacks:
left
                                    apple
right
                                    orange
sum
                                    result
Here are my images:
tree1  tree2  mask  trees 
                    autumn                                           winter                                               mask                                                 auter
eye   hand   mask   handeye
                                        eye                                                                                       hand                                                                                   mask                                                                               eye in hand