Project 3: Fun with Frequencies and Gradients!

Samantha Lai

cs-194-26-afr

 

Part 1.1: Warmup

On the left is the original image and on the right is the sharpened versions. I chose parameters that made the photos look noticeably sharpened but still somewhat realistic.


before emir 

before emir

 

Part 1.2: Hybrid Images

Below is a low pass filtered image of Abraham Lincoln superimposed with a high pass filter of my boyfriend, whose name is Lincoln. I noticed that the sigma values I used in this hybrid image were much smaller than the values used to make the hybrid of Derek and Nutmeg. I believe that this is due to the very dark parts and sharp edges in the the Lincoln images, which mean that to not overpower each other, a very small band in both the high and low frequencies is needed.


before before before

 

Below is the log Fourier transform of the hybrid image.


before

 

Here, I attempted to make a hybrid of two pictures of myself- one with a happy expression under Storke Tower at UCSB and one with a sadder expression under the Campanile at UC Berkeley. I think this failed because the images were not similar enough in composition, so there are large artifacts from different positions of my hair and the towers.


before before before

 

Below is the log Fourier transform of the hybrid image.


before

 

Part 1.3: Gaussian and Laplacian Stacks

Here is a Gaussian stack of my favorite hybrid image.


 

Here is a Gaussian stack of the Dali painting we saw in class. It shows that at lower frequencies, the image more and more resembles Abraham Lincoln. Gala is already barely visible in the first image.


 

Here is a Laplacian stack of the same Dali painting we saw in class. Gala is visible in almost all of them, since she is made up of high frequencies.


 

Part 1.4: Multiresolution Blending

before before before

 

before before before

 

The image below is formed with an irregular mask.


before before before

 

Here is a Laplacian stack of my irregular mask blended image. This depicts the actual layers that were blended together to create the image.


emir emir emir emir emir

 

Part 2: Gradient Domain Processing

In gradient domain processing, the goal is to use information provided by the gradients of an image to seamlessly blend two images together.

Instead of trying to preserve pixel intensities in the source image, we take advantage of the fact that human vision is largely just the perception of gradients and reconstruct the changes between pixels in the source image once it is placed into the target image. We can do this in two distinct steps: a) constraining the source image to preserve its gradients within itself and b) constraining the gradient between the pasted source image and target image at the borders to match the gradient of the source image at the same location.

Part 2.1 Toy Problem

The toy problem is a special case of Poisson blending where the region of interest is the entire image. Additionally, we constrain one pixel to be the color of the source image, which is something not done in general Poisson blending. Once we know the inter-pixel differences in the source image, we can reconstruct it pixel by pixel by solving a least squares problem where the constraints are the gradients between pixels.


       Original                              Result

Part 2.2 Poisson Blending

My workflow consisted of calculating gradients in the mask and then manually pasting the calculated image into the target image, which is why the dimensions of the penguin look slightly changed in the blended target.


For the 'stealth penguin' image, I made the source image blend into the dark tree region. This was interesting because it is apparent that the gradients of the penguin were preserved, since you can still see its facial features, but it has dramatically changed in color to match the trees.


DISCLAIMER: I was unable to get my code to work for anything other than the provided sample images before running out of time. I understand this isn't sufficient to get the points for this section, but I figured I would display the images that I was able to create, although I have since modified my code a LOT to try and make my own images work and unfortunately don't have time to debug it back to the working version. Sorry :(


        No Blending                      With Poisson Blending               Stealth Penguin (it's in the trees)