Onur Ulusel Asgn1

CS143 - Introduction to Computer Vision

Onur Ulusel (oulusel)
Sep 26, 2011

Assignment Description

The aim of this assignment is to create hybrid images using gaussian and laplacian pyramids. Gaussian pyramids conserve the low frequencies of an image while the laplacian filter conserves the high frequencies. By combining the low and high frequencies of different images, an hybrid image can be generated which will resemble the figures of the low frequency image when looked from a far and will resemble the properties of the high frequency image when looked closely.

Implementation

The implementation of the algorithm was done purely in MATLAB. First two images are read and alligned to match sizes and objects in the figures. Then laplacian and gaussian pyramids of the images are generated seperately. The two figures used as initial exemples are showed below.

The gaussian pyramid is generated by first using the original image as the base of the pyramid. Every other level of the gaussian pyramid is a blurred and downsampled version of the previous level. The blurring is done by using the 'imfilter' function of MATLAB and using gaussian filters of different sizes and sigma values for each image pair. The filter is generated by 'fspecial' function of MATLAB. The downsampling is simply taking every other pixel of the image on both x and y axis. The gaussian pyramid for our sample images is given below.




Laplacian pyramid is generated by taking the difference of each subsequent gaussian pyramid level for the same image. Because of this, the depth of laplacian filter will always be one less then the gaussian filter. The laplacian pyramid for our sample images is given below.




Once the gaussian and laplacian pyramids are generated for both images, the higher frequencies of the laplacian of one image and the lower frequencies of the gaussian of the other image are combined. A variable pyramid level is used as the cutoff frequency. Combining of the pyramids uses the reverse process of creating the pyramid. The hybrid of the two images is given below.


More Results

Einstein and Marilyn

A Rhino and A Car

A Whale and A Bus

Bonus Material

All the samples so far were used with grayscale images. So I have also tried working with colored images to see how other channels can be used in hybrid images. I picked the rhino and car image pair to test since both have distinct colours.

First I used RGB images and used each of the three channels as different images in my implementation. At the end I had three hybrid images, one from each different channel. When these are combine at the end, the following figure is obtained.

Then I repeated this experiment using the RGB channels of one of the images and grayscale version of the other image. For this case the grayscale image was added to all three channels seperately and the resulting three channels were combined at the end. The first image below uses the colored car image and the next one uses the colored rhino image.


Using this method, the blue color from the car was too dominant when it was used and the green color of the rhino was hardly noticable. However using the color for the higher frequency image made more sense since the colors of the low frequency image dominated the sharp edges by the high intensity image otherwise.

Since the RGB color domain didn't give satisfactory results, I also tried using YCbCr domain to create colored hybrid images. One difference I had using the YCbCr domain was that I didn't use CbCr channels to create pyramids and merge pyramids at all. They were simple combined at the end after the hybrid image was constructed using just the Y channel. When using the colored version ofboth of the images, I simple took the average of CbCr channels for each pixel value. If only one image is used as colored, the CbCr channels of that image is used as te CbCr channels of the hybrid image. The results can be seen below.
Using color features of both images:

Using color features of the car image:

Using color features of the rhino image:

This method to be more successful. And it was observed again that the color features of the high intensity image should be used for hybrid colored images for better results.