CS 143 / Project 1 / Image Filtering and Hybrid Images

Hybrid Image of a cat and a dog.

A Hybrid image is an image generated by combining the low frequencies of one image with the high frequencies of a second image. This new image has the property that from close it resembles the high frequency image but then resembles the low frequency image as you get further away.

Hybrid Image Algorithm

The hybrid image image algorithm takes as input 2 images. The high frequency features are removed from one image by filtering (described below) it with a Gaussian filter. The second image is filtered with a Gaussian filter and that resulting image is subtracted from the original image. This removes the low frequencies. The two resulting images are then added together (pixel by pixel) in order to produce a hybrid image.

Image Filtering Algorithm

The filtering algorithm takes as input an image and a filter. The image is represented by a 3 dimensional matrix (x, y, channel). A new image, with the same dimensions as the original image, is created by taking the summation of the dot product of the filter and a sub-matrix of the image. This is done for every sub-matrix and channel in the matrix. More formally this can be written as:

Where h is the new image, g is the filter, and f is the original image. The summation is done for all pixels in g which are indexed by k and l. In order to handle pixels near the edge of the image, the original image is padded with R zeros on each side where R is the radius of the filter.

Results

The table below consists of hybrid images (and intermediary images) created by applying the hybrid image algorithm to various pairs of images. The table is formatted as follows: image A, image A filtered for high frequencies, image B, image B filtered for low frequencies, and the hybrid image at various scales.