This project explores how filters and frequencies interact in different and curious ways.
To find the magnitude of a gradient, we first find the derivative of the image with respect to x and then the derivative of the image with respect to y. Second, we square both dx and dy and add them together. Finally, we take the L2 norm of this sum. All these calculations are done element by element.
In this section, I first convolved a partial derivative filter in the x direction with the cameraman image. Then, I convolved a partial derivative filter in the y direction with the image. Here are the raw and binarize derivatives.
Here is the gradient magnitude.
After applying the Guassian filter to the camera man image, I discovered that the image was blurred significantly.
With the Gaussian blurred derivative filters in x and y directions, I created another set of image edges. Here are the result. These are a lot smoother than the finite derivative filters. However, the general shape of the edges remain the same.
Here is the gradient magnitude. With the Gaussain blurring effect, the edges traced by the gradient magnitude are much smoother than using the finite difference operator alone.
In this section, instead of blurring the original image with a Gaussian filter, we create the derivatives of the Gaussian filter by convolving the Gaussian filter with the Dx and Dy derivatives. Here are the results.
Here is the gradient magnitude. The result is verys similar to the finite derivative filters' result.
The edges by blurred finite difference filter and derivatives of Gaussian are very similar besides some differences possibly due to padding and noise. This is expected because convolution should be associative and commutative.
To blur an image, I convolved a 2d Guassian filter with the original image to get the low frequencies.
To sharpen an image, I first blurred an image using the method mentioned above. Then, I substracted the low frequency layer from the original image to get the high frequency layer. Finally, I added the high frequency layer to the blurred image to get the sharpened image. The blurring and sharpening steps can be consolidated into one filter by applying the Gaussian fitler scaled by alpha subtracted from a unit pulse filter scaled by (1 + alpha). This way we can sharpen the image with only 1 filter.
I used an alpha value of 0.8, a Gaussian sigma value of 5, and filter size of 20 to sharpen the Taj Mahal image. Here is a comparison between the original and the sharpedn image.
This is a blurry photo due to lack of sufficient lighting and unsteady camera. I attempted to sharpen the image. The blurriness was reduced. However, as expected, the shakiness of the photo did not change.
Sharpening the image made the watermark background out significantly.
In this section, I intentionally blurred a photo of ferns canyon and sharpened it with my sharpening filter. The resharpened image did not come close to the quality of the original image. This might be due to the lossy nature of the Gaussian blur. In other words, sharpening a Gaussian blurred image cannot restore all high frequency information lost through the blurring process.
In this section, I created a hybrid image by stitching together the low frequency layer of one image with the high frequency layer of another. I extracted low frequency layer through a Gaussian filter and high frequency layer through a Laplacian filter. My three attempts at creating hybrid images are listed below.
Here I created a hybrid image of Olivia Rodrigo in her Sour and Guts eras. I took the low frequency from her Guts photoshoot and overlayed the high frequency from her Sour photoshoot on top. Up close, you can see the Sour era image and the Guts era image when you are far away.
Below are the Fourier domain frequencies.
Here, I created a hybrid image between a rainbow trout and a brown trout. The low frequency layer came from the rainbow trout image, so you can see the rainbow trout from afar. You can see the brown trout when you are up close as the high frequencies came from the brown trout image.
Here, I attempted to create a hybrid between two elk photos taken at different time. In one photo, the elks are head bumping one another, whiel in the other photo, one the elks raises its head. No matter which picture acted as the low frequency layer, the high frequency layer always disappeared. When I tried to blur the low frequency layer further, the background low frequency layer became too blurred to be recognized. This was probability because the identification of elks required a lot of high frequency information, thus the low frequency layer cannot be blurred too much. However, once this the high frequency of the low frequency layer is retained, the high frequency layer had too much overlap with the low frequency layer thus disappearing from the hybrid result.
Here are some select Laplacian stack images for the apple and the orange.
Here is the result for blended orapple image.
I first created Laplacian stacks for the first image, the second image, and the filter mask. Then at each layer of the stack, I convolved each mask with both images to create two intermediate results. Then, I computed the average of the two masked images and collapsed the Laplacian stack to reveal the final result. Blending layer by layer smoothes out the connection between two images, allowing for an elegant transition from one image to another.
I changed the serene evening sky of the eel river into show of lightning.
I blended together 3/4 of a golden trout and 1/4 of a rainbow trout together.
I explored an additional three combinations of color vs gray image hybridizations. Here, I will present the hybridization with gray image 1, color image 2; color image 1, color image 2; and color image 1, gray image 2.
Image (1) and (3) are pretty similar because the purple color of the low frequency is very overpowering, so it draws attention to the low frequency at short and long distances. Thus, the hybrid effects in (1) and (3) are not very good. Comparing (2) and (4), we can see that the all gray scale hybrid image's Sour era details are too faint to be eye-catching at close range. Since the major details that signify the Sour era are the colored stickers, allowing the Sour's high frequency color to come through (2) is significantly better than the all gray scale hybridization. Therefore, I think image (2) is the best hybrid image out of the four.
I have used color for blending the orange and the apple, golden trout and rainbow trout, and eel river and lightning. It has enhanced the appearance of the resulting images.
I really enjoyed this project! I learned that frequencies, when manipulated correctly, can produce very interesting results.