CS 194-26 Project 2: fun with filters and frequencies

oraple oraple oraple oraple oraple oraple oraple oraple oraple oraple oraple oraple oraple oraple oraple oraple oraple oraple oraple

Fun with Filters

Finite difference operator - no blurring

General summary of graident magnitude computation

We generally compute gradient magnitude at the ij-th entry as some function of the square root of the ij-th entry of the grayscale image convolved with Dx squared plus the ij-th entry of the grayscale image convolved with Dy squared, as can be seen in the equation below. (We use Gr for the grayscale image.) The grayscale image convolved with Dx or Dy can be blurred, either after Dx is applied or with a single composite convolution where Dx and Dy are pre-convolved with the Gaussian filter.

The original cameraman image used throughout this question.

Cameraman convolved with D_x

Cameraman convolved with D_y

Gradient magnitude image

Binary threshold (cutoff=0.3)

Finite difference operator - Gaussian blur

Used was a 7x7 Gaussian kernel with sigma=1.4

D_x convolved with gaussian

D_y convolved with gaussian

Blurred cameraman convolved with D_x

Blurred cameraman convolved with D_y

Gradient magnitude image

Binary threshold (cutoff=0.05)

The edge images are thicker without the high-frequency features that you see in the unblurred version. This is particularly noticable when comparing the binary threshold images together. The unblurred variant has jagged contours that seem to fit the very pixels, whereas this actually has meaningful stroke width on edges. In general, this is a better representation.

Gaussian blur pre-convolved with finite difference operators

Gradient magnitude image

Binary threshold (cutoff=0.05)

In general, the differences are relatively minor. The binary thresholded images are similar, especially on the main edges of the image. The single convolution does produce more specks in the thresholded image though....

Fun with frequencies!

Image sharpening

Used was a gaussian of 7x7 and sigma 1.4 across the board for blurring and the unsharp-mask.

Taj Mahal (original)

With unsharp applied (alpha=2)

"Deep fried" (alpha=200)

The face details of the Taj Mahal appear more clear against the background, as these are the higher frequency features.

Robot with sentimental value

With unsharp applied (alpha=5)

The texture of the foam side pad and structural channel edges holes seem more clear under a sharp filter.

Already relatively sharp robot image

With unsharp applied (alpha=5)

In the above set of images, we blur the image first before sharpening. The "resharpened" image's holes on the robot's structural channel seem blurrier than the original image. This makes sense as we likely lost that information on the blur pass, and the high frequency pass is going to have a hard time getting those lost frequencies back out of thin air.

Hybrid images

For this, I pre-align the input images by adapting the starter code to save image alignments. We first consider the starter images as a walkthru of the basic idea. We use Hoiem as the low-frequency component and Nutmeg as the high-frequency component. To threshold, we blur both using a Gaussian that is 55x55 and sigma 15.

Derek Hoiem

His frequency spectra

Nutmeg

Nutmeg's freq. spectra

Low-passed Hoiem

Freq. spectra

High-passed Nutmeg

Freq. spectra

Hybrid image

Freq. spectra

We note how the frequency spectra of the low-pass image seems to limit high-frequencies to the axes (Gaussian filtering is not an ideal LPF), while the high-pass filter seems to remove the low frequencies near the center of the spectrum (which is expected.) We can see the overlay of the high-frequency elements in the final hybrid image.

More hybrid images

(with apologies to the eecs dept)

Anant Sahai (from our EECS faculty page)

Gireeja Ranade (also from faculty page)

i couldn't get this idea out of my head ok i'm SORRY

Only colorizing the low-freq element (Ranade)

Only colorizing the high-freq element (Sahai)

Note that I flipped Ranade over the y-axis so their shoulders would line up better. I was not going to submit this hybridization but I think it's actually a good result, just extraordinarily cursed, and I'm out of time. My apologies if you have to grade this. We used Sahai as the higher frequency element, because he has glasses. In general, having the lower frequency component have color seems to work better, and there's not much difference between having both parts have color and only the lower frequency component. This makes sense as the lower frequency component seems to act as sort of a base for the rest of the image.

FTC team 9971 from here

FTC team 8644 from here

Hybrid image

This kind of works, but at the saime time, not really. You can see segments of 8644's robot overlaid on top, but it doesn't really have the same level of coherency that human subjects do. The high frequency nature of robots in comparison leads to much less of a good effect, so to speak.

Multiresolution blending using Gaussian/Laplacian stacks

oraple oraple oraple oraple oraple oraple oraple oraple oraple

Apple

Orange

Composite

Presented above is a table similar to Figure 3.42. The layers shown are from layers 0, 2, 4, and the final sums of the laplacians. This is presented in just grayscale for simplicity, but if we apply this same process to each rgb channel, we can get...a color oraple! The color oraple blends pretty well across all channels, so this really simple extension across three channels works really well.

Color oraple can't hurt you...right?

More multiresolution examples

There is no god. In this realm...

Alexandria Ocaiso-Cortez. Ben Shapiro. The mask used.

...there is only facts and logic.

One more fusion -- one that's less cursed.

Nobody on the Internet knows...

A friend. His favorite breed of dog. A simple vertical mask.

...if you're actually a dog.

(stock dog source is (c) Eric Isselée / stock.adobe.com)

What was learned?

Basically, I learned how to use frequency analysis on images to create the most cursed abominations known to man. I took a lot of classes on signals and systems in an EE context but not a whole lot as applied to images, so this is all new to me. The multiresolution blending stuff with Laplacian pyramids is a fascinating construction.

You made it to the end! yay!

(buttons sourced from https://cyber.dabamos.de/88x31/)