Fun with Filters and Frequencies!
Michael Jayasuriya
Using Gaussian and Laplacian stacks to bring Tattoine to planet earth.

Introduction

Viewing images through the frequency domain yields us many different techniques to create neat visual effects. Before computers, Salvador Dali and Leonardo Da Vinci stunned us visually by playing with low and high frequencies in Painting of Gala looking at the Mediterranean sea which from a distance of 20 meters is transformed into a portrait of Abraham Lincoln and the Mona Lisa. With these tricks and computers we can create some cool shit.

Gradient Edges

Image of a cameraman convolved with d_x and d_y.
We can combine the results of convolving our images with d_x = [1, -1] and d_y = [1, -1].transpose() by finding the gradient magnitude, which is sqrt((img ∗ dx)**2 + (img ∗ dy)**2) where ∗ denotes a convolution operation.
Gradient magnitude and binarized edges, threshhold=0.2 chosen by trial/error.

Left images are without blurring, right are with blurring.
I notice that the edges on the man in the image are way stronger in the gaussian filtered image. We can also see that the gaussian filter removes the noise at the bottom of the filter, by looking at the binarized edgee image after gaussian bluring. We can simplify this computation even further by using a derivative gaussian filter, or a filter that is the convolution of d_x and the gaussian filter G and a second filter which is the convolution of d_y and G. By convolving at the start, we no longer have to blur the initial image but can do the convolution and gradient both in one go.
DoG for x and y.
Using the DoG and convolving 2d gaussian kernel with the image both give the same result as seen in the above images.

Image sharpening

When an image is convolved with a 2d gaussian kernel, this acts as a low pass filter, only letting in low frequencies. We can use this idea to our advantage in image sharpening. First take an image, subtract the low frequencies from the image to get the high frequencies, and then add back the high frequencies into the original image.
Scroll through the above images sharpened with alpha = 0 (original), 1, 2, 3, and 5.
As alpha goes up, the image eventually adds in too much of the high frequency values, making the image look very strange.
The images above are sharpened with alpha = 0, 10, 30. Artifacts start coming in with higher alpha.

Hybrid images

If we take the low frequency of one image and add it to the high frequency of another image, we get an effect of an image changing by distance. Close up, we see the finer details, the high frequencies. When far away we see the low frequencies.
We take the low frequencies from the left image and high frequencies from the right image.
We use a gaussian filter to get the low frequencies of one image, and then on the other image we use a gaussian filter to get the low frequencies and subtract that away from that origianl image to get the high frequencies. After extracting the low frequencies from one image and high frequencies from the other, we can add them.
We can apply this to a few other images as well.
From far away we see the young lady, and when we move closer up she ages and becomes old!
Clark kent turns into superman up close. This one was a fail.
For Clark Kent turning into Superman, no values of sigma really helped me achieve a good result. One does not get the sense that clark kent is actaully turning into superman in this image, so it was a fail. For the most part it just looks creepy :(.

Image blending with Laplacian and Gaussian Stacks

Using ideas from the 1983 paper by Burt and Adelson, if we make a laplacian stack from 2 images, and a gaussian stack for image masks, we can apply the masks to each image at each respective level of the stacks and then sum them all up to get a image that has better blending than simply taking half the image and adding it to half the other image.
Laplacian stacks for apple, orange, and oraple.
Gaussian stacks for apple, orange, oraple.
Finally after masking at each level of the stack and summing the results, we get the oraple.
If we use color, the blending looks a lot better.
I've always loved the scene from Star Wars with Luke standing on Tattoine with 2 suns in the background, so I used this technique to attempt to recreate that.
Growing up I also liked the show cat dog on Nickelodean, so I tried to make one of my own. My input images weren't very good, so my outcome was also poor.