Project 2: Fun with Filters and Frequencies!
CS194-26 Fall 2021 | Rio Hayakawa
Part 1: Fun with Filters
1.1: Finite Difference Operator
By convoluting the image below, ‘cameraman.jpg’ with finite difference operators, it showcases the differences between filtering by the x and y directions. The finite difference operator for the x direction is shown by [1,-1] and the y direction is shown by [1, -1]^T.
original ‘cameraman.png’ |
|
Partial Deriv in respect to Y |
Partial Deriv in respect to X |
|
|
The gradient magnitude of the image represents the edge at a specific pixel and is calculated by doing an element-wise computation of the partial derivatives of x and y directions, given by magnitude = sqrt(d_x^2 + d_y^2). Below is the gradient magnitude of ‘cameraman.png’.
gradient magnitude (gm) |
gm w binary threshold of 0.28 |
|
|
1.2: Derivative of Gaussian (DoG) Filter
The image was then blurred using a Gaussian blur of ksize 6 and sigma of 2.
Partial Deriv in respect to Y |
Partial Deriv in respect to X |
|
|
gradient magnitude (gm) |
gm w binary threshold of 0.15 |
|
|
With the blurred image as a base, there are a lot less noisy areas in the image and the lines themselves are a lot more thick and clear to where the edges are. Where the edge lines of the unblurred gm are jagged, the lines of the blurred gm appear more like strokes in vector images.
Below is the gaussian and finite difference convolutions combined together in to a single filter before applying it to the image. Below are images of the derivative of gaussian filters.
dX of gaussian |
dy of gaussian |
|
|
gm of single filter |
it w binay threshold of 0.15 |
|
|
Between the single convolution and not, the single convolution gm is more darker but the binary image of the gm appears to be very close, showing the end result is very similar between the two.
Part 2: Fun with Frequencies!
2.1: Image “Sharpening”
By subtracting a low freq image (created by passing a gaussian filter of kernal size 9 and sigma of 3) from the original image, we
isolate the high frequencies and from there we can add it onto the original to create a more ‘sharpened’ image
‘taj.jpg’ before sharpening |
‘taj.jpg’ after sharpening |
|
|
‘dog.jpg’ before sharpening |
‘dog.jpg’ after sharpening |
|
|
As we can see the sharpened images indeed to appear to be more clear on the edges.
Here we blur the original and call sharpen on it.
‘dog.jpg’ blurred |
‘dog.jpg’ blurred and sharpened |
|
|
We can see its not the as good as the original but it still is better than nothing.
2.2: Hybrid Images
Below is the fourier analysis of the intermediate steps in creating a hybrid image of Prof. Anjoo and what I assume is her kitty.
prof. anjoo |
fft of anjoo |
|
|
prof. anjoo’s cat? |
fft of ket |
|
|
high-passed kat |
fft of cet |
|
|
low-passed prof. anjoo |
fft of low-pass anjoo |
|
|
anjat |
fft of anjat |
|
|
prof. alexei |
go bears! |
|
|
alear |
|
VIN DIESEL |
yuki-chan the seal |
|
|
yukin DIESEL |
|
I chose these two images because the head shape and eye silhouette were similar but after hybridizing them, realized that the result is not that convincing. I assume it is because the high frequency features are not the prominent in yuki-chan the seal.
2.3 & 2.4: Multi-resolution Blending and the Oraple journey
The famous oraple!
|
apple |
orange |
oraple |
lv 0 |
|
|
|
lv 2 |
|
|
|
lv 4 |
|
|
|
lv 8 |
|
|
|
merged |
|
|
|
More multi-resolution blending examples!
splent |
|
starhome |
|
Project 2: Fun with Filters and Frequencies!
CS194-26 Fall 2021 | Rio Hayakawa
Part 1: Fun with Filters
1.1: Finite Difference Operator
By convoluting the image below, ‘cameraman.jpg’ with finite difference operators, it showcases the differences between filtering by the x and y directions. The finite difference operator for the x direction is shown by [1,-1] and the y direction is shown by [1, -1]^T.
The gradient magnitude of the image represents the edge at a specific pixel and is calculated by doing an element-wise computation of the partial derivatives of x and y directions, given by magnitude = sqrt(d_x^2 + d_y^2). Below is the gradient magnitude of ‘cameraman.png’.
1.2: Derivative of Gaussian (DoG) Filter
The image was then blurred using a Gaussian blur of ksize 6 and sigma of 2.
With the blurred image as a base, there are a lot less noisy areas in the image and the lines themselves are a lot more thick and clear to where the edges are. Where the edge lines of the unblurred gm are jagged, the lines of the blurred gm appear more like strokes in vector images.
Below is the gaussian and finite difference convolutions combined together in to a single filter before applying it to the image. Below are images of the derivative of gaussian filters.
Between the single convolution and not, the single convolution gm is more darker but the binary image of the gm appears to be very close, showing the end result is very similar between the two.
Part 2: Fun with Frequencies!
2.1: Image “Sharpening”
By subtracting a low freq image (created by passing a gaussian filter of kernal size 9 and sigma of 3) from the original image, we
isolate the high frequencies and from there we can add it onto the original to create a more ‘sharpened’ image
As we can see the sharpened images indeed to appear to be more clear on the edges.
Here we blur the original and call sharpen on it.
We can see its not the as good as the original but it still is better than nothing.
2.2: Hybrid Images
Below is the fourier analysis of the intermediate steps in creating a hybrid image of Prof. Anjoo and what I assume is her kitty.
I chose these two images because the head shape and eye silhouette were similar but after hybridizing them, realized that the result is not that convincing. I assume it is because the high frequency features are not the prominent in yuki-chan the seal.
2.3 & 2.4: Multi-resolution Blending and the Oraple journey
The famous oraple!
More multi-resolution blending examples!