The goal of this project was to manipulate images using gradients and frequencies. For part 1, by using Gaussian and Laplacian representations of my images, I can generate sharpened images, hybrid images (that show different objects at different distances), and seamlessly blend objects. For part 2, I improved seamless blending using the poisson blending technique to calculate gradients.
To sharpen an image:
high_frequency = input - low_frequency
output = α * input + (1-α) * laplacian
This section was implemented using the SIGGRAPH 2006 paper on creating static images that appear to show different subjects depending on the viewer's distance. When viewing images at a distance, the eye perceives low-frequency information. When closer, the eye is able to detect the high-frequency details.
Gaussian and laplacian stacks are collections of the same image (of the same size) with incremental filtering on top. For example, gaussian stack will start with the input image.
G_1(A) = Gaussian(A)
For i in 1...d: G_i(A) = Gaussian(G_{i-1}(A))
L_1(A) = A - G_1(A)
For i in 1...d: L_i(A) = G_i(A) - (G_{i-1}(A))
Often we see images that seem like they can't be real... Well, with seamless blending, you can manipulate images to blend two different images together to appear as if they're one. Multiresolution blending takes in two images you want to blend as well as a binary (black/white) mask that will specify which parts of an image you want to keep. Procedure:
Multiresolution blending works well, however, it doesn't always do a good job on blending away seams. With starkly contrasted backgrounds (as in the globe example), portions can bleed over due to the Gaussian. Additionally, creating the masks can be time intensive as they need to be exact. This is where Poisson blending comes in. Given two images and an approximate mask, it can copy the source image to a different background seamlessly and without needing the user to create intricate masks.
In this section, I calculated the x-gradient and y-gradient of the input image to reconstruct the input image. The x-gradient is calculated by subtracting the source pixel from the neighboring pixel to the right for all pixels in the image (getting the x-gradinets). The y-gradient is calculated by subtracting the source pixel from the pixel above for all pixels in the image (getting the y-gradients)
I reconstructed Buzz and Woody as shown in the spec. The images aren't particularly impressive as I take in the input image, calculate the gradients to get a matrix of form Av = b where b contains the known values and A has the coefficients of the values we're looking for (which will be equivalent to b).
|
|
|
|
Poisson blending is obviously better in this case as no extra work was necessary to colorize the image. Additionally, the multi-resolution blend sometimes bleeds onto the target background which is problematic. Poisson blending alters the colors of the source image though (as a key characteristic on how the method works) so if color constancy is important, then multiresolution with color will probably work better.
|
|
This project was definitely fun to work on and definitely introduced me to another side of image manipulation outside of Photoshop. Although computers are often able to accomplish amazing feats of blending, a human is still needed in the loop. With sloppy matching/masking/etc, the image results will be subpar. I hope that I can learn more about blending for images with different backgrounds as that stlil remained a problem in many of the above cases.