Here, we will sharpen a few images by making use of the unsharp mask filter. At a high level, this means creating an edge representation of an image and adding a scaled version of it to the original. The idea is that blurring takes away detail (i.e. what we think of as edges, mostly) from an image – so to sharpen, all we have to do is add that detail back. Mathematically, we have the following relationship:

original + α(detail) = sharpenedwhere α is a scaling factor.

How do we get the edge representation? That's where unsharp masking comes in. We'll first obtain a low-passed ("unsharp") version of the image by convolving it with a 2D Gaussian filter. Then, to retain only the components in the image with higher frequencies, we'll subtract our unsharp version of the image from the original. Finally, once we have the high-frequency image, we can scale it and add it to the OG image in order to arrive at our sharpened result.

If

`f`

is the input image, `g`

is our 2D Gaussian kernel, and `e`

is the unit impulse, then
sharpened = f + α(f - f * g) = f * ((1 + α)e - αg)Note that

`*`

is the convolution operator. Also note that we have some choice in how we construct the Gaussian filter; we're able to select both the kernel width and the standard deviation (σ) of the curve. In all of the following cases, I use a 20x20 kernel and a σ of 5, as these values seemed to give the best results.
`Turtle (before)` |
`Turtle (after)` |

`Campanile (before)` |
`Campanile (after)` |

`Dennis (before)` |
`Dennis (after)` |

A hybrid image is defined as a static image that changes in interpretation as a function of the viewing distance. It is created by combining the low-frequency version of one image with the high-frequency version of another. From up close, the high frequencies dominate the image, but when viewed from afar, the low frequencies take over because they're the only thing a person can see. Below is an example of Derek hybridized with his cat Nutmeg. In it, we retain the low-passed version of Derek and the high-passed version of Nutmeg.

Here, we will create a hybrid of Trump and Clinton. Trump will be used as the low-frequency image, which means that Clinton will be used as his high-frequency counterpart. To the right of the images are the log magnitudes of the images' Fourier transforms, so that we can observe what happens in the frequency domain as we go. The low frequency cutoff for Trump is 0.02 Hz, while the high frequency cutoff for Clinton is 0.03 Hz.

`Trump (spatial domain)` |
`Trump (frequency domain)` |
`Clinton (spatial domain)` |
`Clinton (frequency domain)` |

`Low-pass (spatial domain)` |
`Low-pass (frequency domain)` |
`High-pass (spatial domain)` |
`High-pass (frequency domain)` |

`Hybrid image (gray)` |
`FT of hybrid image` |
`Hybrid image (color)` |

Below we have another example, which merges a dog and a wolf. This time, the low- and high-frequency cutoffs are both 0.05 Hz. The Gaussian filter is still 25x25.

`Dog + Fourier transform` |
`Wolf + Fourier transform` |

`Low-pass (spatial domain)` |
`Low-pass (frequency domain)` |
`High-pass (spatial domain)` |
`High-pass (frequency domain)` |

A Gaussian stack is simply the original image convolved with a bunch of Gaussian filters of increasing σ. Meanwhile, the Laplacian stack is the difference between successive levels of the Gaussian stack. Both of these, applied to Salvador Dalí's *Lincoln in Dalivision* lithograph, are shown below.

(All Laplacian stacks displayed in this writeup have had their images' pixel intensities normalized for easier viewing, such that the minimum value is always 0 and the maximum value is always 1.)

`Gaussian stack (σ = 1, 2, 4, 8, 16)`

`Laplacian stack, normalized`

`Gaussian stack (σ = 1, 2, 4, 8, 16)`

`Laplacian stack, normalized`

As the final part of the project, we blend together two images by constructing a Laplacian stack for each of the images to be blended, and a Gaussian stack for a mask. Then each of the layers in the two Laplacian stacks are linearly combined using the corresponding layer in the Gaussian mask stack, and results from every layer are collapsed (summed together) in order to arrive at the final, blended image. This has the effect of creating a very gentle seam between each of the two images.

Parameter-wise, I used a Gaussian kernel size of 25x25, a σ of 1, and ten levels in each of the Gaussian and Laplacian stacks.

`Orange` |
`Apple` |
`Mask` |
`Oraple` |

`Laplacian stack (space)` |
`Gaussian stack (mask)` |
`Laplacian stack (biker)` |

`This Laplacian image was one of the highlights of the project` |

`The blended image (biking in space!), grayscale` |

`Multiresolution blending... in color!` |

`Wall-E` |
`Mask for R2-D2's head` |
`R2-D2` |

`Wall-2D2 (gray)` |

`Wall-2D2` |

`Pawn` |
`+` |
`Queen` |
`=` |
`Qawn` |

Sadly, I have never swum with turtles or (perhaps not as sadly?) met Donald Trump or Hillary Clinton face-to-face. So a huge shout-out to the following sources for the images used in this project! In order of appearance:

- The slightly blurry turtle photograph was obtained from William John Holly on DeviantArt.
- Derek and Nutmeg were downloaded from the assignment page.
- Part 1's Donald Trump image was acquired here.
- The Hillary Clinton image was acquired from her official Twitter.
- The photograph of the German Shepherd is from the Wikipedia article on German Shepherds.
- The wolf image comes from the website for the San Diego Zoo.
- The illustrated version of Lotad is from this Imgur page, and originally from the anime I think.
- The illustrated version of Lombre is from PkLucario on DeviantArt.
- The sprite-ified Lotad is from IGN.
- The sprite version of Lombre is also from IGN.
- Pikachu showed up on "Jaden's Adventures Wiki," which I of course visit regularly to stay updated on Jaden's adventures.
- Raichu comes from the Pokémon Database.
- Lincoln was snatched from the assignment page.
- The apple and the orange were – like Derek, Nutmeg, and Lincoln before them – swiped from the assignment page.
- The space picture originally appeared on wallpaperwarrior.com.
- The cycling picture comes from – where else? – bicycling.com.
- The reversed Wall-E image hails from an HD wallpapers website.
- R2-D2's likeness was retrieved from Wookieepedia.
- The pawn comes from Wikipedia.
- Strangely enough, the queen also comes from Wikipedia.

- An explanation of the Laplacian of Gaussian
- An explanation of the Spatial Domain and Frequency Domain
- An explanation of the Unsharp Filter
- An explanation of Convolution
- An explanation of Gaussian Smoothing