Alexander Kristoffersen, akristoffersen@berkeley.edu
Part 1.1
Gradient magnitude is calculated first calculate the partial derivatives of the image in the X and Y directions. This is done with a convolution of a [+1, -1] and a [+1, -1]^T-- the D_x and D_y filters respectively. Then, the magintude is found pixelwise by square rooting the sum of both squared pixel values. This is binarized using a threshold to remove any unwanted noise under a specified magnitude.
Part 1.2
By applying a gaussian filter before calculating the gradient magnitude, it looks a lot cleaner! The outlines are more solid, and there is a significant decrease in the picked up background noise!
This can also be done in a single convolution by applying the gaussian directly to D_x and D_y:
Part 2.1
Sharpening can be added by removing the low frequency 'blur' from an image and heightening its high detail, high frequency components.
Part 2.2
I've found that results can be fairly good if the blurred (far-away) image is fairly recognizable, even if the images do not 'line-up' as two faces would. I can test the accuracy of these hybrids by standing far away, and seeing a fairly accurate image of President Lincoln, and then zooming in to see a faint but distinguishable image of a pirate.
The effects of this can be seen in the frequency domain:
This doesn't look like much of a difference, but when we subtract the hybrid spectrum with the pirate spectrum, we see that almost all of its high frequencies match exactly, and the difference-- the low frequencies from Lincoln-- are different:
This does not work well for every set of images. Take a photo of myself with the Mona Lisa, by Leonardo Da Vinci:
Part 2.3
LA[0]
LB[0]
Merge[0]
LA[2]
LB[2]
Merge[2]
LA[4]
LB[4]
Merge[4]
Result left
Result right
The oraple!
Part 2.4
We can use the same technique of multi-resolution blending on other images:
We can also do the same thing with irregular masks:
Overall, this was a really interesting project! I am surprised how well some of these techniques worked, especially the multi-resolution blending. Seeing the results first-hand in the frequency graphs was really mesmerizing.