In this project, I worked on many aspects of image manipulation. From edge detection to image blending, I really did it all.
The first part of this project focused on edge detections using 2D convolutions and filtering.
I began with the finite difference as the filter in the x and y directions. I simply convoluted an image with these derivatives to get the partials, and then manipulated them to get the gradient magnitude. When this gradient met a certain threshold, the pixel was colored in. This naive approach gave a good, but noisy result. Below we see the partial derivatives with respect to x, then y, then the gradient magnitude image, and finally the binarized edge image.
To help with the noise, I simply smoothed the image using a Gaussian filter. However, instead of convoluting the image with this filter and then both the dx and dy filters, I convoluted the Gaussian filter with the dx and dy filters, and then the image with those. As seen below, a good amount of the previous noise is gone. Below is the Gaussian filter convoluted with dx and dy, and then the less noisy edge image.
Now onto the meat of this project, working with frequencies.
Image sharpening involves strengthening the high frequencies so that it appears more crisp. Below we can see a picture of the Taj Mahal before and after a very strong “sharpening.” Details are much more noticeable.
Here is another image that’s been “sharpened.” This time the image was blurred, and then that blurred version was sharpened. Below we can see the original image, the blurred image, and the sharpened image.
Now onto hybrid images; these are really fun. By combining the high frequencies of one image with the low frequencies of another, the resulting image appears to morph between the two depending on your distance away. Below are some examples of this. A guy with a cat, a llama with a pretty sunset at Foothill, Keanu with the matrix text thing, and Pharrell Williams from happy and while crying.
More interesting though much less easy to understand are their 2D Fourier transforms, shown below in the same order. (Note: the images above were cropped, so the images below won’t be the same size as they won’t be cropped to show them in all their beauty.
Most of the hybrid images I made above only looked good in one way. Mostly due to the needed color or detail in one of the images. However, one hybrid that I couldn’t get to work was a pizza pie. The colors class, and they both have their own details and patterns that don’t work well. You can make out both images from close and far away, but they just don’t work as well as the others.
This part of the project caused the most headaches. Gaussian stacks are made by repeatedly convoluting an image with a Gaussian filter and keeping track of it at each level. Laplacian stacks are just the difference between each level of the Gaussian stacks. Sounds easy in principle, and that’s what I thought during lecture, but my code kept needing more and more debugging until it finally worked. Below you can see a figure similar to that of the paper that shows the Laplacian stack. In the end, we have a fairly convincing oraple.
I did this again, but combining them vertically,
Finally, I made it so that I could blend two images using any sort of mask I want.