By Adam Chang
In this part of the project, we convolved a finite difference kernel over an image in order to calculate gradients in both the x and y directions. The finite difference operators are [[-1, 1]] for dx and [[-1],[1]] for dy. The dx operator computes changes in the image intensity in the horizontal directions. The dy operator computes changes in the image intensity in the vertical directions. Dx catches vertical lines in the image, while dy catches horizontal lines in the image. We then calculate the magnitude of the gradient at each pixel by taking squared sum of the gradient in both directions, adding them, and then taking the square root. Below are the results of performing the Finite Difference Operation on the provided cameraman.jpg.
In the second part of Part 1, we apply a gaussian kernel filter to the image before performing the finite difference operation. This blurring reduces the high frequencies and gets rid of the noise causing the random white dots throughout the edge image in Part 1.1. However, we also lose the already blurry background buildings from our edge image. After applying the gaussian blur, these are no longer discernable as edges, which may or may not be desirable. We also show that convolutions are associative. Instead of applying the gaussian kernel blur to the image and then performing the finite difference operation, we pre-compute a derivative of gaussian filter by applying the finite difference operators to the gaussian kernel, and then convolving the combined filter to the image. This results in the same output image.
In Part 2.1, we perform an image "sharpening" operation by extracting the high frequencies of the image and increasing their intensity. As discussed in lecture, this is not actually performing sharpening, which would in its true form be adding higher frequencies to the image than currently exist. Instead, this operation provides the illusion that there are higher frequencies by intensifying the already existing high frequencies in the image. Below are results from sharpening images.
Original | Sharpened |
---|---|
We also performed a test to see that this operation is not equivalent to actually sharpening the image. We blurred an image, then performed sharpening on the blurred version of the image and we observe the results and compare the sharpened blurred image to the original. It becomes quite obvious that the original resolution and sharpness was not recovered by the sharpening operation, and instead lines in the blurred image become more intense and contrasty. The sharpened image also contians a lot more noise than the original.
In Part 2.2, we generate hybrid images, images that are comprised of 2 different component images, only one of which is visible at any one time based on how far you are standing away from the image. We take one of the component images and run it through a low pass filter and the other component image and run it through a high pass filter. Adding the two images results in a hybrid image. If you are close the image, you can make out the high frequencies of the component image run through the high pass filter. If you are far from the image, you can only make out the low frequencies of the component image run through the low pass filter. Below are hybrid image results. We see in the last example with the tree and the sapling the important of alignment. Regardless of the high and low pass filters, if the two images don't line up for most of their subject matter, both images will be visible at the same time.
Component Image 1 | Component Image 2 | Hybrid Image |
---|---|---|
For the car hybrid image with the Camry and Apollo IE, we perform a discrete fourier transform to see the effect of our filters and how the two images are added to form our final image.
Part 2.3 had us create Gaussian and Laplacian stacks of images. Gaussian stacks are created by convolving successively larger and higher sigma gaussian kernels against the original image to generate blurrier and blurrier images (lower frequencies). Laplacian stacks represent the difference between successive images in the gaussian stack. Below is a visualization of the laplacian stacks of the apple and orange as well as the blended oraple.
In addition to the oraple example, we perform blending on some custom image pairs to generate some interesting images. We also support using custom masks as opposed to the vertical divide down the center of the image.
Below is another example blending a cat and a tank. We see that the alignment is very critical and minor misalignments lead to only limited success in blending.
We can create a laplacian stack breakdown for the cat and tank blended image just like for the oraple above.