CS 194-26 Project 2
Siddharth Karia
1.1
Original image:
Gradient magnitude image:
Binarized:
1.2
Blurred version:
The image is quite clearly gaussian blurred: the edges are not as sharp since surrounding pixels are averaged across it.
D_x D_y convolved gaussian:
The edge detection is the same as before, only slightly blurred.
1.3
For gradient computation, I simply went through a set of rotations of the image (in my case, -8 degrees to +7 degrees), and performed the
following calculations for each.
1. Crop the rotated image to ignore rotation-generated edges
2. Create a gradient image by convolving the rotated image with dx and dy (finite diff filters) and calculating arctan of d(image)/dy over
d(image)/dx
3. In this gradient matrix, convert to degrees and count the number of angles that fall at 0, 90, 180, -90 degrees within a certain error (in my
case, 3 degrees)
4. Find the ratio of this number of degrees that satisfy the conditions over the total number of elements in the matrix
5. Find the max of said ratio out of all rotations - this is the angle we choose
Original image:
Rotated image at -3 deg:
Histogram of gradient angles for the rotated image:
As you can see, there are several peaks at -90, 0, 90, and 180, giving us the max number of 90 degrees to vertical/horizontal angles.
Another image:
Rotated image at -5 deg:
Histogram:
This one is not quite as obvious in the number of multiples of 90 degree angles, but there is still a general trend for peaks around those
numbers
Another image:
Rotated image at -6 deg:
This one was extremely straight-forward, we had sharp peaks at -90 and 90 degrees when aligned, due to the square goal post and sharp
contrast in color between it and the background.
Failure case:
Rotated image at -8 deg:
This image was rotated wrong, even when searched through the valid angle it should have been rotated to. Interestingly, the histogram
showed a lot of evenness across the image in angles. It was almost definitely the blank space at the bottom that was giving a lot of random
angles but at very small magnitudes, causing my approach of simply looking at the angles of the gradients and not the length of them, to not
work as well.
2.1
Original unsharpened image:
Sharpened image:
Blurred image:
Sharpened after blurring:
It looks kind of similar to the original image, but it only sharpens the most dominant features of the image, leaving formerly blurred parts to
still be pretty blurred.
Another image:
Sharpened knife:
2.2
2 original images made into hybrid:
Hybrid:
Colors made this much harder to get right, as the human and cat are now easily distinguishable because of hair color, clothing, skin color,
etc. If both were grayscale, it would blend much better. The cat is high-passed and the man is low-passed.
First row is fourier of the original Derek and Nutmeg.
Second row is fourier of the filtered images (Laplacian on left and Gaussian on right).
Third row is fourier of the final hybrid image.
2 images used for hybrid (Federer and Djokovic)
Hybrid:
This actually works reasonably well, although the face shapes make it a little bit hard. Close up, djokovic is quite clearly visible, and further
back, Federer is all we can see.
Second set of images (Zverev and Tsitsipas):
Hybrid (kind of failure):
I wouldn't necessarily call this a complete failure, but Zverev doesn't become visible until you're maybe 20-30 feet away. No matter what
sigma values I tried to reduce the high-pass on tsitsipas / reduce the low-pass on zverev, it was hard to make it such that there was a clear
distinction at something like 10 feet away. I attribute this to the fact that they have both very similar face shapes and hair styles. Furthermore,
Zverev doesn't have a beard, so it looks a little like Tsitsipas no matter how much Zverev comes in when you're farther away.
2.3
For stacks, I just used the default painting:
Gaussian stack:
Laplacian stack:
As the stack grows further, the sharper parts get more and more visible, since those are being sharpened on top of each other and enhanced
each time; those are the only edges in each level of the stack.
2.4
Multiresolution bending was difficult to get completely right, as the sizes of gaussians and laplacian stacks mattered significantly in how
blurry / fried the end result was.
Original images:
Multiresolution blending result:
Another set of images (Moon and Mars):
Multiresolution blending result:
The moon and mars blend almost perfectly!