Project 2: Hybrid Images

Favorite result

This combines an image of a polar-bear and a hippo, retaining the low frequency components of the polar-bear image and the high-frequency components of the hippo image to create a hybrid. The hippo can be seen in the result when it is examined up close, but when you step a few metres away the hippo appears to fade away and you see the polar bear.

The basic method of achieving this is to use a low-pass filter on the polar-bear image and a high-pass filter on the hippo image. I used a Gaussian blur filter (a natural low-pass filter, since blurring equates to removing high frequencies), applying it directly to the polar-bear image for a low-pass filter. The resulting image as shown below is blurred, and the corresponding Fourier transform shows that the frequencies of the image are concentrated around the middle of the 2D frequency domain, i.e. the low frequencies. To do the high-pass, I applied a low-pass to the hippo image, then subtracted the result from the original image, retaining the high frequency components in the difference. The resulting filtered image of the hippo below reflects this retention of sharp edges and fine details. Finally, the filtered images are summed to produce the final hybrid image.

The program allows me to specify cut-off frequencies for the low-pass and high-pass filters (in this case, 25 cycles/image for the low-pass and 40 cyes/image for the high-pass). There is a mathematical relation between the cut-off frequencies and the standard deviation of the Gaussian filter, namely that (stdev = k*(N/fc)); k is a constant, and N is the width of the image (we assume it is roughly square-shaped), and fc is the desired cut-off frequency. The intuition is that a higher cut-off frequency should correspond to less blurring, since more higher frequencies are retained. In the equation, this is reflected as stdev decreases when fc increases: a lower standard deviation produces a filter response that is 'sharper', i.e. that weights pixels further away from the center of the image relatively less than a filter of larger standard deviation would, and thus blurs the image less than a filter of larger standard deviation would. Because a larger standard deviation filter needs to take into account pixels that are further from the middle, I also make the size of the filter a function of the standard deviation (10*stdev).

In order for the features to blend pleasantly, I pre-aligned them by scaling and rotation (using the given starter code), so that the bodies of the animals lined up.

Additional results

Bells and whistles

I implemented Gaussian and Laplacian pyramids for the hybrid images. At the lower levels of the pyramids (where minimal filtering has occurred), we can observe the high frequency image still. At higher levels of the pyramids (after multiple stages of filtering) the high frequency components are blurred out and the low frequency image becomes apparent.