Sharpening

In the first step, input images are sherpened using unsharp masking. It is defined as adding the difference between the blurred and the original image, in other words high frequencies, to the original image. The level of sharpening can be controled with the sigma value. The larger value of the sigma means a wider peak for the gaussian filter which leads to greater blurring. Here, I used a 7x7 gaussian filter with the sigma of 5. For gray scale image, the filtering is only done on the image converted to gray scale but for color image, each channel is filtered seperately. Sharp images and the high frequencies added to the original image is shown below.

Original Image Sharp Image (Color) Sharp Image (Grayscale)
R Channel G Channel B Channel Grayscale

Hybrid Images

A hybrid image is a combination of two images that is not percieved the same when viewed from different distances. To have a hybrid image, high frequencies of one image should be combined with low frequencies of another, so that the first image will be seen from a short distance and the second one from farther distances.
The procedure that is utilized in my program is as follows. In the first step, both of the images are sharpened using unsharp masking. Sharp images are aligned with the function provided. Then, the average of two images is calculated and smoothed with 10x10 gaussian filter of sigma 5 to act as a base for the hybid image. Futhurmore, the first image is low pass filtered with a gaussian filter with the sigma of 5 and the size of 10x10. For the second image, it should be filtered with a high-pass filter. To do so, it is low-pass filtered with a guassian filter of the same size and sigma value and subtracted from the original image to have an image of high frequencies remaining. At the end, the three results are added to build a single hybrid image.
The procedure is demonstrated below with the log magnitude in the frequency domain.

My favorite hybrid image

Victoria Beckham Original Image David Beckham Original Image

As we can see in the sharp images and their frequency log magnitude, the image of Victoria has more details or high frequencies which are spread around the center but David's image has more low frequencies since it's mostly in the center of log magnitude. In general, the center of the log magnitude in frequency domain includes low frequencies which contain the most important information about the image. In log magnitude, vertical lines in the image are represented as horizontal lines and horizontal lines are represented as vertical.

Sharp Image Log Magnitude of FFT Sharp Image Log Magnitude of FFT

After applying low-pass filter, those frequencies around the log magnitude are eliminated, leaving the log magnitude with frequencies in center. The opposite thing happens for high-pass filter image, having mostly frequencies around. It's worth mentioning that for example, as there are vertical and horizontal lines in Victoria's image we can see horizontal and vertical lines in its log magnitude. Also in David's log magnitude, if we look closely, we can see a very thin line that represents the edge made in alignment process.

Low-pass Filter
Gaussian 10x10 sigma = 5
Log Magnitude of FFT High-pass Filter
Gaussian 10x10 sigma = 5
Log Magnitude of FFT

At last, the log magnitude of the hybrid image is a combination of the center of David's log magnitude and Victoria's log magnitude surroundings.

Hybrid Image Log Magnitude of FFT

Other Hybrid Images

1. Justin Trudeau and Sophie Grégoire-Trudeau

2. Brad Pitt and Angelina Jolie

3. Albert Einstein and Marilyn Monroe

4. And something different!

Gaussian and Laplacian Stack

1. Gaussian Stack

The process of producing guassian stack for grayscale images contains a function with recursive calls that applies gaussian filter to the original image with an increasing sigma value in each iteration (That is 2,4,8,16,...). As a result, high frequencies will diminish by filtering the image with larger sigma in each step, leaving low frequencies. So from the first image to the last one in stack, we can recognize a sequence of images showing the conversion from the first image of the hybrid combintion to the second.
There is a difference between the method used for storing the stack with grayscale and color images. As color images have three channels, their stack is stored in a matrix with four dimensions, the fourth one for counting each RGB image. But the stack of grayscale images are stored in one matrix with three dimensions as the output of the stacking function.

Sigma = 2 Sigma = 4 Sigma = 8 Sigma = 16 Sigma = 32 Sigma = 64
Sigma = 2 Sigma = 4 Sigma = 8 Sigma = 16 Sigma = 32 Sigma = 64

And the gaussian stack for my hybrid image:

Sigma = 2 Sigma = 4 Sigma = 8 Sigma = 16 Sigma = 32 Sigma = 64

2. Laplacian Stack

At first I used fspecial command to make a laplacian filter, but the result was so poor because the window size of the laplacian filter is unadjustable and predetermined by MATLAB to 3x3 which is so small. Since guassian filter is a low-pass filter, by subtracting it's result from the original image we can have a high-pass filter equal to laplacian.

Sigma = 64 Sigma = 32 Sigma = 16 Sigma = 8 Sigma = 4 Sigma = 2

Laplacian stack for color image of Lincoln and Gala:

Sigma = 64 Sigma = 32 Sigma = 16 Sigma = 8 Sigma = 4 Sigma = 2

And my hybrid image:

Sigma = 64 Sigma = 32 Sigma = 16 Sigma = 8 Sigma = 4 Sigma = 2

Multi Resolution Blending

In the first step, laplacian stack of both input images and guassian stack of the mask are built. The mask acts as a weighting factor in constructing the final image. Since levels of the guassian stack are filtered with an increasing sigma, we see the mask borders change gradually from one image to another. Then, based on the equation provided in the paper, a stack is calculated. Finally, the result image is built by summing up the levels of that stack.

Gaussian stack of the vertical mask:

The stack built using the equation:

Final result:

Grayscale Color

Blending other images

1. Moon in the hand

2. Baby guy

3. Boat

I have also implemented the method above for color images but the results were not satisfying.

Sources

David Beckham - Victoria Beckham - Justin Trudeau - Sophie Grégoire-Trudeau - Brad Pitt - Angelina Jolie - Cat - Moon - Ball - Guy - Baby - Boat - Landscape