Include a brief description of gradient magnitude computation:
To get the gradient of the image, we first have to realize we are taking convolution in
two directions. The first direction Dx = [1, -1] while the second direction Dy = [[1], [-1]].
When we convolve the image with these kernel, we would get the following results.
Then using the magnitude function (sum(square dx + square dy) then square root) we can find the gradient magnitude as shown.
Lastly, we will also threshold the magnitude image to reduce noises.
Instead of directly applying our dirivative kernal, we now first low pass filter
our original image (blur) before we apply the dirivative kernal.
What differences do you see?
The results we get seems to reduce noise a lot better. The edge lines are more clear (thicker).
Lastly, we first apply the gaussian to the kernal and convolve them.
The result of this we will call it as DoG.
Then we apply the convovled kernals to the original image.
We now can verify that we get the same result as before. We can see the result
filtered image is identical to the previous one we see. This shows that convolution
is an associative operation.
In this section we will use the low pass filter to find the low frequencies. By subtracting the low frequencies form the image, we will then have the high frequencies. We will enhance the high frequency image and add it back to the original image to sharpen it. There is a mathematical simplification for this process. Essentailly we can create one single mask such that when we directly convolve with the image, the sharpening process as described will be performed. I show both result of taking the long process and compared it to unsharp mask filter enhancement. You can see that the results are essentailly the same.
Now, to make this more interesting, I would first intentionally blur an image. From that image, I would then run it through the enhancement process to see if we can get back something that looks as sharp as the original. The results show that the sharpened image actually turned out to be as sharp as the original non-blured image!
For this section we will create hybird images which when look from far and close will show different results.
Let's look at the Fourreier analysis on one of these sets of pictures
This one didn't work out. I believe it is due to the fact that original 2 has strong backgroud lines. When taking the high frequency of it, it seems to dominate the lower frequency portion of image.
In this part we will show the process of blending an orange and an apple using
Gaussian and Laplacian stacks with the following procedure.
1. Take an image and create a Gaussian stack by continuing convolve with Gaussian.
2. Create Laplacian stack by taking the differences of the Gaussian stack. Append the last element of Gaussian stack onto the Laplacian stack.
3. Take a mask and create a Gaussian stack for it.
4. For each element in the Laplacian stack, multiply it with the mask. This will result in an array of masked Laplacians.
5. Repeat steps 1 to 4 with another image and a mask that is the negative of the one of step 4.
6. Take the two masked Laplacian stacks, add them element-wise to get a blended stack.
7. Collapse the blended stack by summing all the element in the stack to get a blended image.
Besides the Orange Apple Example, I also played around with some of other images.
Lastly, we have to perform the same blend with iregular shapes. I created the iregular masks through an online drawing tool and convert it to a binary mask in python.