Project 3: Frequencies and Gradients

Part 1.1: Warmup For this portion of the assignment, the goal was to sharpen a blurry image. I found a blurry image of a leopard online, ran a high pass filter on the image (subtracted the gaussian from the original image), and added an alpha factor of the laplacian to the original image. The results are shown below. (Blurred, Sharpened)

Part 1.2: Hybrid Images For the next portion of the assignment, the goal was to disguise two images in a single one, by making use of the high and low frequencies that make up the images. This was accomplished by running a high pass filter on one image, and a low pass filter on the other, and then averaging the pixel intensities of the two filtered images at each pixel. The image onto which the low pass filter was applied was also converted into a grey image, as the color details did not help distinguish it from the other image. This was because color added extra noise that made the high-pass image difficult to distinguish up close (Which is also why color had a positive effect when left on the high-pass image, it added more details up-close that vanished at large distances). Below is the picture of Derek and the cat before and after running the program.

Another example of hybridization I made was with a bubble and a flower (with the low pass filter performed on the bubble). The bubble is clearly visible from far away, but looks like a shadow on the flower from up close. This also clearly demonstrates the ability of color to improve the visibility of high frequency images (yet is imperceptible from far away).

Finally, one particularly bad example occurs when using an image without many distinctive features/edges as the high-pass image. The flower image was used once again, but this time with a space picture blended in:

This can also be seen through an analysis of their fourier spectra. In order from left to right (Flower Image, Gaussian, Space Image, Laplacian, Hybrid):
Clearly, the gaussian of the flower has a very distinct features in it's spectra, which can be easily seen in the final image. The laplacian of the space image meanwhile does not.

Part 1.3: Gaussian/Laplacian Stacks For this portion of the assignment, I recursively created a gaussian and laplacian stack, by recursively applying a gaussian filter to the image, computing the laplacian of the image, and then setting the new image to the gaussian. At the base level, the previously calculated gaussian was returned.

Part 1.4: Multiresolution Blending The goal of this portion was to blend two images together using a mask, which a gaussian filter was then applied to. This gradually reduces the pixel intensities near the edge of the mask, which allows another image (masked in the same way) to be overlayed on top, giving a smooth transition from the pixels of one image to the pixels of another. Using the color of the pixels as part of the gaussian filter improved the transition. A blend of the apple and orange can be seen below.

Another example with an irregular mask (various parts of the gecko image were masked out).
A third example of a wave and a landscape shot.

Part 2.1: A Toy Example For the first part of the poisson blending assignment, I formulate three different objectives, namely that: 1. The gradients of x-neighbors of each pixel match those of the source image as closely as possible 2. The gradients of y-neighbors of each pixel match those of the source image as closely as possible 3. The first pixel of the resulting image should have the same intensity as the first pixel of the source image This can be solved using a least squares solver, returning the original image.

Part 2.2: A Toy Example For the final part of this assignment, the objective is to blend one image into another. Since I did not have matlab installed on my machine, I aligned the images and masked them manually. The only difference between this and part 1 is that now, I find the closed-form solution to the matrix. This requires a square matrix, so all the neighbors are compared as part of a single equation (and thus row in the matrix). Moreover, both the neighbors are compared in all directions, instead of just one direction as in 1. Finally, the edges of the image now consider the pixel intensities of the target image.

A failure case occured when trying to blend the image from the toy problem with another very bright image. Since the characters in the toy image were surrounded by a very dark background, the intensities in the dark background increased significantly, which caused the already bright characters to become even brighter.
When comparing the multi-resolution blending to the poisson blending, the multi-resolution blending clearly works much better for images of similar size (since one image will completely dominate the other with poisson blending). For images with sharper lines, the poisson blending also introduces clear seams (though there is some level of blending of the seams). This is seen with the example below. However, as seen with the examples above, the poisson blending does not have the ghosting problem, and is likely more effective when an image needs to be adjusted for different lighting conditions.