The goal of Project 1 is to write an image filtering function and use it to create hybrid images: static images that change in interpretation as a function of viewing distance (such as the image on the right. At normal viewing distance it looks like a cat, but from far away, or if you squint, it looks more like a dog). High frequencies dominate perception when available, but at farther distances, only lower image frequencies are visible. Hybrid images can be created by blending the high frequency part of one image with the low frequency part of another.
Computing the high and low frequencies of images can be accomplished using image filtering: processing an image into a new image of the same size by applying mathematical operations with a grid of numbers. More specifically, computing frequencies can be accomplished with linear image filtering. The general equation of a linear filter is
filtered_image(m, n) = sum(filter(k, l) * image(m + k, n + l))
sum sums from k = 1, l = 1 up to size(filter).
|
|
|
||||||
|
|
|
A Gaussian filter blurs the image to extract its low frequencies. To compute the high frequencies of an image, apply the Gaussian filter and subtract the resulting image (which consists of low frequencies) from the original image.
A hybrid image is the sum of the low frequencies of one image and the high frequencies of another. A "cutoff frequency" determines what constitutes a high or low frequency - there is no best cutoff frequency; what works best depends on the image input.
![]() |
![]() |
Original Marilyn image | Original Einstein image |
![]() |
![]() |
Marilyn low frequencies | Einstein high frequencies |
![]() |
Hybrid Marilyn/Einstein images |
Observe that the larger image resembles Einstein much more closely, while the smaller images resemble Marilyn more so.