The primary goal of this project is to explore the different behaviors and associated methods of various filters and image processing techniques that allow us to edge detect, sharpen, and blend images. Many of these methods involve the convolution of an image with a gaussian filter of varying parameters in order to exploit its use as a low-pass filter, allowing us to manipulate the many different frequencies within an image to create the desired effect.
In order to compute the gradient magnitude of an image, first we need to compute the derivatives of the image with respect to both the "x" and "y" directions. To do this, we use the differentiation operators D_x = [1, -1] and D_y = [1, -1].T and convolve them each with the original image (converted to grayscale). Now that we have the derivatives of the image in both directions, we can compute the gradient magnitudes by simply applying the magnitude formula: (D_X^2 + D_Y^2) ^ 0.5 where D_X and D_Y are our derived image in both the "x" and "y" directions respectively.
Edge binarization parameterized by threshold value = 0.2
In this part, we work through the same process as earlier, except this time applying a gaussian filter first to blur the image and remove some of the higher frequencies. As a result, the detected edges are a lot less noisy and stronger, giving us a better edge detector.
All images were generated with a gaussian filter of size 3 and sigma 1.
By deriving the gaussian filters first, we can see that the resulting detected edges are essentially identical to that of the prior two-step method. Both methods are taken with threshold value = 0.1.
To sharpen images for this section, we apply an unsharp mask filter to the original image. To do this, we take the original image and apply a gaussian blur like in previous sections, then subtract the blurred image from the original in order to obtain just the high frequencies. Then, all that is left is just to add a multiple (parameterized by alpha) of the high frequencies onto the original image, resulting in a sharpened image.
All images were generated with a gaussian filter of size 3 and sigma 1.
To create a hybrid image, first the images are aligned with the provided starter code. Then, we take the low frequencies of the first image by convolving it with a gaussian kernel, while we get the higher frequencies of the second image by subtracting the low frequencies of the second image (similarly convolving the second image with a gaussian kernel) from the original (aligned) image. Adding these two together outputs the final hybrid image
Derek – NutmegFor a failure case, we can use this car and airplane example. This might be because the two objects are simply too different, resulting in a less than optimal hybrid blend.
Comparing the three different variations, it seems like coloring the low-frequency component produced the best result. This could just be due to alignment or due to the compability of the two images at a deeper level, as the results in general aren't all that great.
Parameters: sigma1=1, sigma2=8
For this section, the construction of the Gaussian and Laplacian Stacks involve convolutions with a gaussian kernel in a manner much like the previous parts. First, for the Gaussian Stack, a gaussian kernel is recursively convolved with the image, essentially layering blur actions on top of each other. Then, for the Laplacian Stack, each level is computed by taking the difference between successive Gaussian Stack layers (element [i] - element [i + 1]). In generaly, the depth (or iterations) was set to 5.
Dali StacksParameters: size=3, sigma=1
Parameters: size=5, sigma=2
Parameters: size=5, sigma=2
Parameters: size=5, sigma=2
Multiresolution blending in this part builds upon the stacks created in the last part. Gaussian and Laplacian Stacks are constructed for both imageA (GA, LA) and imageB (GB, LB) and a Gaussian Stack (GR) is also constructed for the mask denoting the area to focus blending. Then, at each layer the algorithm (GR * LA) + ((1 - GR) * LB) is applied to blend at each level. Once this new blended stack is created, the output image is just the layers summed up in addition to the last layer of the Gaussian Stacks of imageA and imageB respectively.
Tennis Ball / SoftballParameters: size=15, sigma=4
Parameters: size=3, sigma=1
Parameters: size=15, sigma=4
I used an irregular mask here, specifically a box mask centered around the faces/head areas of the cat and dog.
Parameters: size=5, sigma=2
For this one, to get the tiger to align correctly with Mcgregor's tattoo I had to resize the tiger image by padding it appropriately to match up. For the mask, I created a box centered around the tiger and the aligned region so that most of the blending would be focused in that area.
Parameters: size=21, sigma=23
Mcgregor Laplacian Stack
Tiger Laplacian Stack
Blended Laplacian Stack
As seen above, all of the blended images were done with color. For me personally, I learned a lot about how gaussian filters and kernels can be used to process images! I had always known that it acts like a low-pass filter for images from previous classes, but expanding upon that in application and using them to sharpen, blend, and create stacks is very interesting!