Fun with Filters and Frequencies

Jackson Gold

Introduction

This project examines how frequency manipulation can be used to enhance and merge images in innovative ways. Techniques like boosting high frequencies make images appear sharper by emphasizing fine details, while basic filtering methods help identify edges by detecting changes in pixel values. We also explore creating hybrid images by combining detailed, high-frequency elements from one image with the smoother, low-frequency areas of another. Finally, Gaussian and Laplacian stacks are utilized to blend images across multiple frequency layers, enabling seamless and natural-looking transitions.

Part 1: Fun with Filters

1.1: Finite Difference Operator

We use finite difference operators to detect edges by convolving the image with D_x and D_y. The results are shown below:

Original Cameraman Image
Cameraman Image
Partial Derivative in X Direction
Partial Derivative in X
Partial Derivative in Y Direction
Partial Derivative in Y
Gradient Magnitude Image
Gradient Magnitude

By binarizing the gradient magnitude, we suppress noise and highlight real edges, as shown below:

Binarized Gradient Image
Binarized Gradient Image

Observations: The threshold value is crucial in balancing noise reduction and edge visibility. A value of 0.09 was used

1.2: Derivative of Gaussian (DoG) Filter

The DoG filter combines Gaussian smoothing with finite difference operators, resulting in less noise compared to the previous approach.

Blurred Image with Gaussian Filter
Blurred Image with Gaussian
DoG Filter in X Direction
DoG in X
DoG Filter in Y Direction
DoG in Y
Gradient Magnitude Image
Gradient Magnitude
Binarized Gradient Image
Binarized Gradient Image
Dog Filter X
Gradient Magnitude
Dog Filter Y
Binarized Gradient Image

Observations: The Gaussian filter smooths noise while retaining significant edges.

Part 2: Fun with Frequencies

2.1: Image "Sharpening"

Original Blurry Image - Taj Mahal
Original Blurry Taj Mahal Image
Sharpened Image - Taj Mahal
Sharpened Taj Mahal Image
Convolution Sharpened Image - Taj Mahal
Sharpened Taj Mahal Image
Original Blurry Image - Canyon Country Store
Original Blurry Image of Your Choice
Sharpened Image - Canyon Country Store
Sharpened Image of Your Choice
Convolution Sharpened Image - Canyon Country Store
Sharpened Image of Your Choice
Original Sharp Image
Original Sharp Image
Blurred Version of Sharp Image
Blurred Version of Sharp Image
Sharpened After Blur
Sharpened After Blur Image

Observations: When sharpening the Taj Mahal and other images, the process effectively enhances fine details and restores clarity. However, sharpening a previously sharp image that was blurred shows how the technique recovers some sharpness but may not fully match the original, demonstrating the limitations and effects of noise amplification. It does not look much like the original, however you can see some sharpening specifically in the edges of objects.

2.2: Hybrid Images

Hybrid images blend high frequencies from one image with low frequencies from another, creating a visually dynamic result that changes with distance.

Hybrid Image 1 - Derek
Hybrid Image 1
Hybrid Image 2 - Nutmeg
Hybrid Image 2
Result - Nutmeg and Derek
Hybrid Image 2

Hybrid images blend high frequencies from one image with low frequencies from another, creating a visually dynamic result that changes with distance.

Hybrid Image 1 - Guitar
Hybrid Image 1
Hybrid Image 2 - Turtle
Hybrid Image 2
Result - Turtle Guitar
Hybrid Image 2

Hybrid images blend high frequencies from one image with low frequencies from another, creating a visually dynamic result that changes with distance.

Hybrid Image 1 - Tootsie
Hybrid Image 1
Hybrid Image 2 - Joey
Hybrid Image 2
Result - Tootsie and Joey
Hybrid Image 2
Fourier - Tootsie
Hybrid Image 1
Fourier - Joey
Hybrid Image 2
Fourier Filter - Tootsie
Hybrid Image 2
Fourier Filter - Joey
Hybrid Image 2
Fourier - Hybrid
Hybrid Image 2

Observations: Alignment and filter cutoffs significantly affect the hybrid perception.

2.3: Gaussian and Laplacian Stacks

Gaussian and Laplacian stacks help prepare images for blending by handling different frequency bands separately.

Table Recreation
Gaussian Stack

Observations: These stacks allow for smooth transitions in image blending.

2.4: Multiresolution Blending (Oraple)

Blending with Gaussian and Laplacian stacks creates a smooth transition between images, such as the iconic apple-orange blend. This is the one I definitely spent the longest on. In order to create the masks, I created a drawing tool with cv2 where you can draw over one of the images after spending a very long time creating masks that didn't align.

Oraple (Apple + Orange Blend)
Oraple Image
Earoon (Earth + Moon Blend)
Oraple Image

Ok I spent a long time trying to find an image of a goat and snake that would line up properly, this is the closest I got...

Snoat (Snake + Goat Blend)
Oraple Image

Observations: Blending works best with well-aligned images and proper mask transitions.

Conclusion: Overall, this project was a mix of quick wins and a few time-consuming challenges. I started with edge detection using finite difference operators, then used Gaussian filters to smooth the results and reduce noise. Parts like sharpening images and creating hybrid images in Part 2 were interesting and mostly straightforward, but I hit a roadblock in Part 2.2 with VS Code debugging issues, which took way longer than expected to sort out. Part 2.4 was another tough spot; building the Gaussian and Laplacian stacks from scratch and tweaking the multiresolution blending took much more effort than I anticipated. While these parts dragged on, the other sections went more smoothly, and in the end, seeing the final results made all the debugging and extra work feel worthwhile...maybe.