Proj2: Fun with Filters and Frequencies!

Part 1: Fun with Filters

Part 1.1: Finite Difference Operator

The gradients of an image can be used to show the most varied part of an image. Convolving with finite difference operator along x and y axis can get the partial derivative of the image. Combining the two partials using 2 norm will yield an edge graph. Binarizing with a threshold to cancel noises can give better result.

p11

Part 1.2: Derivative of Gaussian (DoG) Filter

Using Gaussian filter to blur the image can help get rid of the high frequency noises. Then, convolve with finite difference operators to get the edge graph similar to part 1.1.

p121

Convolve the finite difference operator with the Gaussian filter first will get the same result due the property of convolution, as shown below.

p122

Part 2: Fun with Frequencies!

Part 2.1: Image "Sharpening"

Sharpening is a simple technique that boost the high frequency part of an image in order to makes it look more "sharp". High frequency components can be calculated by subtracting the Gaussian filtered low frequency image from the original image.

p21_taj

However, sharpening doesn't give extra details not present in the image in the first place. Take a look at the comparison below: if you sharpen a blurred image, you don't get back the original image.

p21_deer

Part 2.2: Hybrid Images

Combining two different images each preserving a different frequency range can yield some interesting images. These hybrid images have conflicting visual effects: when examined up close, high frequency components dominates, but when looked from afar, low frequency components dominates. This makes people see different images from different distances.

The catman is a classic demonstration.

h h_g

To clearly see what's going on: here are the results from Fourier transform:

Original cat fft: catfft Original man fft: manfft High freq cat fft: highcatfft Low freq man fft: lowmanfft Hybrid fft: hybrid

On other images:

We have Joaquin Phenix hybrid with the Joker

joaquinjoker_g joaquinjoker

But sometimes, the conflict cannot be reconciled:

When I tried to get a hybrid of Anakin and Darth Vader, it looks terrible

anakinvader anakinvader_g

B&W

Color hybrid is easy to generate as well. Just apply the algorithm to each color channel. The result looks cooler but doesn't fundamentally improve the quality.

Part 2.3: Gaussian and Laplacian Stacks

Applying Gaussian filter iteratively can gives as a stack of sub-images with a progressively tighter low-pass filter. Subtracting the consecutive sub-images effetely gives us band-pass filters on different ranges which is called the laplacian stack. Blend different images w.r.t. different frequency bands can produce a beautiful smooth seam.

To visualize:

oraple

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

We blend images using masks that correspond to different shapes. A easy regular mask is either horizontal or vertical.

Here is a horizontal blend:

darkkid brightkid merged_kid

Here is a vertical blend:

children refugee merge

Here is a irregular mask blend:

gt3 road merged_car

You can see that the two cars are selected from their surroundings and seamed onto the road image.

B&W

Color blend is easy to achieve by convolving the filter and mask on the color channels and stack them up. It presents better visual qualities.

Something to contemplate

Those blended children images looks seamlessly smooth, but the jarring contrast of their status is more emphasized. These images present powerful anti-war themed messages that I wish people can relate the sentiment.