This project explored several methos of image manipulation, such as image sharpening through unsharp masking, creating a hybrid image from two source images, using gaussian and laplacian stacks to blend images together, and gradient domain fusion.
For the warmup, I took a blurred image and sharpened it with the unsharp masking technique discussed in class. The function I used is as follows: f + α(f - f * g). This computes the difference between the source image f, and the result of convolving f with a gaussian kernel g, multiples it by a parameter α, and adds it back onto the original value f. The result of this operation can be observed below, where the left image is the original blurry image, and the right image has been sharpened:
This part of the project involved creating a hybrid image from two images by adding the high frequencies of one image to the low frequencies of the other. This yields an interesting end result that shows the low frequencies from a distance, and the high frequences when viewed up close. The images below are good examples of this, with the picture of Derek being more apparent at a distance, and Nutmeg being clearer when viewed close.
The plots below show FFT values for Dalivision Lincoln, the portrait, high and low pass images, and the hybrid result.
|
|
|
|
|
For this portion of the project, I created Gaussian and Laplacian stacks of various images. My Gaussian stacks were formed by repeatedly applying a gaussian filter, yielding progressively smoother images. The Laplacian stack was created by finding the difference between neighbors on the Gaussian stack. The Gaussian and Laplacian stacks for the Dalivision Lincoln are shown below.
Gaussian stack of Dalivision
|
|
|
|
|
|
Laplacian stack of Dalivision
|
|
|
|
|
|
The Gaussian and Laplacian stacks below were formed from the hybrid image of portraits of President Trump (low pass) and President Obama (high pass).
Gaussian stack of Trump-bama
|
|
|
|
|
|
Laplacian stack of Trump-bama
|
|
|
|
|
|
This part of the project involved using Laplacian and Gaussian stacks to blend two images together. The Laplacian stacks of both images are used, as well as a Gaussian stack of an image mask to specify where blending occurs. To achieve the desired result we must create a new stack by computing a weighted sum of corresponding levels from either image's Laplacian stacks and the Gaussian stack, to be used as weights for matrix addition. This results in each layer having a gradual transition between images instead of a visible seam.
This above blended image of a lollipop and an ice cream cone was made using a circular mask. This can be observed in how the blended seam appears to follow a curve, with most of the circular lollipop being visible blended.
This problem involved reconstructing an image from previously computed gradients, as well as one pixel intensity. The problem boils down to a least squares problem, in which we want to match our x and y gradients as closely as possible with those of the corresponding area in the target image. In this case, we're attempting to reconstruct an image based soley on its x and y gradients and the value of its top left pixel.
This part of the project expands upon the toy problem, not being used to blend some portion of a source image into a target image. Several results of this are shown below. Though this method generally works reasonably well, there are several potential issues that arise. Because we are attempting to match gradients in the source image and colors in the target image, the output can have a slight shift in color tone. Additionally, sufficiently different backgrounds in source and target images yield seams that remain quite visible despite the blending.
Additional images
This last image didn't work out as well as I would have liked, in large part due to background color and texture differences. The waves present in the aircraft carrier "cutout" cannot be easily blended into the smoother texture of the clouds. This results in a fairly visible seam that fails to achieve a "seamless" blending. Additionally, the dramatic shift in color causes the aircraft carrier to take on a heavy red tone. This is in large part because of the gradient similarity between the ship and the grayish-blue sea. With the color shifted to red, preserving the gradient yields a reddish ship.
The Laplacian blended image looks a bit strange, mostly because of issues with the mask. The mask matches the penguin 'cutout' exactly, and when it's used to make a Gaussian stack, the smoothed mask layers in the stack end up extending beyond the borders of the penguin image. This results in a black outline. If the mask size were adjusted, a better result would certainly be achievable. Mask issues aside, there are several differences between the blended images that are noteworthy. The first major difference is that there is no shift in color with Laplacian blending, wheras using Poisson blending causes some shift in the new image's color space. In the case of the aircraft carrier, it became somewhat blue or red depending on its surrounding color. In this case, the penguin becomes somewhat darker, taking on more gray/ brown tones. This color change, while somewhat problematic at times, allows Poisson blending to produce relatively seamless images without overlap or ghosting effects. In general, Laplacian blending works best in simpler sitations that don't require many alterations to the source image's color space. Poisson blending works well in most cases and helps hide seams and imperfections by attempting to match the target image's background colors.