Project 1: Image Filtering and Hybrid Images

Image Filtering

In this project we implement Linear Image Filtering. Linear Image Filtering is an example of a local operator or a neighborhood operator which uses a collection of pixel values in the vicinity of a given pixel to determine its final output value. In linear filters, an output pixel's value is determined as a weighted sum of input pixel values as given in the formula, .The entries in the weight kernel or mask h(k, l) are often called the filter coefficients.

Given a filter of size n (n is odd), (n-1)/2 pixels on each edge do not have a proper neighborhood defined for them. We can rectify this in many different ways. In my implementation, I have chosen to pad the image using a reflection of the (n-1)/2 edge pixels.

Here are examples of different linear filters applied on the following image:

Gaussian Filter

Sobel Filter

Discrete Laplacian

Hybrid Images

For this part of the project, we are required to implement a simplified version of the SIGGRAPH paper. Hybrid images are static images with two interpretations which depend upon the viewing distance from the image. The paper takes into account perceptual grouping mechanisms to build compelling hybrid images with stable percepts at each distance. The paper uses hybrid images to create textures that become visible only when seen up close, to generate facial expressions whose interpretation changes with viewing distance, and to visualize changes over time within a single picture.

Hybrid images are generated by superimposing two images at two different spatial scales: the low-spatial scale is obtained by filtering one image with a low-pass filter; the high spatial scale is obtained by filtering a second image with a high-pass filter. The final image is composed by adding these two filtered images.

While any two images can be combined to form hybrid images, aesthetically pleasing hybrid images follow some rules.

I will illustrate the process with an example. Consider the following two images.

By combining the low frequencies of Marylin with the high frequencies of Einstein, we get a hybrid image which has looks like Einstein up close, but like Marylin from afar.

This can be seen much more evidently by looking at the hybrid image in different scales.

Other hybrid images