CS 194-26 : Image Manipulation and Computational Photography

Project 3 : Fun with frequencies and gradients

Mrinalini Sugosh


Overview

The goal of the project is to explore the frequency and gradient domain by playing with blurry images, creating hybrid images, making gaussian and laplace stacks that helped in blending two images. The project also explores the gradient domain where we recreate the Toy Problem as well as apply Poisson Blending to blend images.


1.1 Blurring and Sharpening Images (Warm Up)

The goal was to sharpen an image of our choice by emphasizing the high frequencies of that image. The technique used was unsharp masking technique. The result was obtained by taking the difference between the original image and the filtered image. Here are some results using different values of sigma:

The Majestic Lion

Blurring
Image

Sigma = 0

Image

Sigma = 2

Image

Sigma = 5

Image

Sigma = 10

Sharpening
Image

Sigma = 0

Image

Sigma = 2

Image

Sigma = 5

Image

Sigma = 10

1.2 Hybrid images

The goal of this part was to blend two images into a hybrid image. This was achieved by blending the high frequency of one image with the low frequency of the other image. To obtain the low frequency portion of the first image, a Gaussian filter with sigma = 21 was applied to it. To obtain the high frequency portion of the second image, the difference between the original image and the filtered gaussian image was taken (Unsharp Masking Technique). Then, the two images generated with a low and high frequency are added to get a hybrid image

Black and White

Derek + Nutmeg

Image

Derek

Image

Nutmeg

Image
Image

Hybrid Derek and Nutmeg!!!

Lion + Cat (Failure!)

This example the background was too blurry and required really zooming out to see the original lion image. Additionally the white cat made the high pass filter more distinct

Image

Lion

Image

Cat

Image
Image

Hybrid Lion and Cat :(

Hugenero

Image

John Denero

Image

Josh Hug

Image
Image

Hybrid Hugenero!!!

Fourier Transforms for Hugenero

Image

Bells and Whistles (Colorize Hybrid)

To add color to the effect, I performed the same frequency operations as the grayscale on all three channels to reflect the RGB image

Colorized Hugenero

Image

John Denero

Image

Josh Hug

Image
Image

Hybrid Hugenero!!!

1.3 Gaussian and Laplacian Stacks

In this part, the goal was to implement Gaussian and Laplacian stacks, which are almost like the image pyramids. Instead of downsampling an image like pyramids, for stacks the image is convolved with a Gaussian filter with an increasing sigma at each level. The sigma used for these stacks are (sigma = 2, 4, 8, 16, 32)

Lincoln Dali Stacks

Image

Hugenero Stacks from 1.2

Image

1.4 Multiresolution Blending

In this part, the goal was to blend two images across multiple bands of frequencies. This was done by first constructing the Laplacian stacks for both images 1 and 2 with 5 levels. Then the Gaussian stack of the mask image with 5 levels was constructed. Finally, the Laplacian stack (LS) of the blended image was derived. Equation was Lf = L1(Gm) - L2(1 - Gm) where Lf is the final Laplacian Stack, L1 and L2 are Laplacian stacks of the images, and Gm is the Gaussian stack of the mask.

Orapple

Image

Apple

Image

Mask

Image

Orange

Result!!!

Image

Sporty

Image

Soccer Ball

Image

Sporty Mask

Image

Tennis Ball

Result!!!

Image

Bells and Whistles (Colorize)

The goal was to try and colorize the images. I took a similar approach to blending in grayscale but across different channels. Unfortunately, the image resulted in a darker intensity. Image

Gradient Domain Fusion

This part of the project explores Gradient Domains of image processing!

2.1 Toy Problem

The goal of this part was to reconstruct an image given its gradients. In this part, we first computed the x and y gradients from the provided toy image. Then used up all the gradients plus a known pixel intensity (top-left pixel) to reconstruct our image.

Toy Image

Image
Image
Image

Doggy

Image
Image
Image

2.2 Poisson Blending

In this part, the goal was to blend two images given a mask. Similar to the toy problem, solved the images for the gradients and added the boundary constraints to the problem.

Penguin on your Ski Trip

Image

Background Image

Image

Object

Image

Mask

Result!!!

Image

Epic Fail

Image

Black and White worked better

Image

YAYYY PENGUIN SUCCESSFULLY WENT SKIINGp>

Penguins love to hike!

Image

Black and White didn't work so well for this one since the penguin was a lot brighter than the background

Image

Worked well blended a bit too much with background

Throw back to Multiresolution Blending

Image

Multiresolution blending

Image
Image

Poisson Blending


Acknowledgements

I would like to thank the staff for giving me the opportunity to work on the project! So glad I got to do this :) Also, like to thank the several students on Piazza who answered my questions, provided skeleton code for masks, and provided clarifications. Stack Overflow is my best friend after this project :) (All questions Numpy answered lol)