rogerngo.com / Notebooks / Hybrid Images
Roger Ngo, email@example.com
- Part 1
- Part 2
- Bells and Whistles
My favorite result was a hybrid image between former President Barack Obama and First Lady Michelle Obama.
The low frequency image chosen is President Barack Obama. The high frequency image is Michelle Obama.
The result of this picture turned out quite well. I used a
sigma_low value of 15
sigma_high value of 10 for the low, and high pass frequency cutoffs respectively.
When viewed close up, the hybrid image exhibits more of the high frequency characteristics. In this case, a lot of the image involving Michelle Obama is displayed. As one steps back further away from the screen, they will start to see more of the low frequency characteristics of the image. In this case, more of Barack Obama.
I have included a 10x downsampled hybrid image to simulate the effect of stepping further away from the screen.
There are a few reasons as to why I think this result turned out well.
- Both images were aligned very well without any modification.
- Barack Obama chosen as a low frequency image is a good choice in that he is still a recognizable figure when viewed from afar.
- Michelle Obama is a good high frequency image because of some of the strong details exhibited in the original image such as necklace, jewelry, facial make up and other things that make her "visibly female".
- Barack Obama: Wikipedia
- Michelle Obama: Biography.com
Lion and Tiger
I had to tweak the parameters here to have
sigma_low = 10 for low frequency cutoff and
sigma_high = 7 for the high
I had initially assumed that the Tiger would not serve as a good low frequency component for the hybrid image. The main reason was being that the stripes may have provided too much detail that would not display well when downsampled. However, I was wrong here and that the image came out fine. I think it is because tiger stripes are easily recognizable when viewed from afar. The lion was a good choice for high frequency component of the image because of all the hair on the mane.
- Lion: Scientific American
- Tiger: National Zoo
Roger and Alexa
Here are pictures of myself and my wife. It was taken at the beach a few years ago. Using myself as the low frequency image was easy as in comparison, I do not have make up on my face. Since I have less detail and am still recognizable as an adult male.
Again, the frequency cutoffs had to be adjusted.
sigma_low = 20 for the low frequency image, and
sigma_high = 10
for the high frequency image.
- Roger: (self)
- Alexa: (wife)
I had used one of my wedding photos, and cropped it for this picture.
The method I had used to perform contrast enahncement is to first convert the image into the HSV color space.
I used the
cv2.equalizeHist function to perform the equalization.
Then, histogram equalization is applied on the luminance (V) channel of HSV as that corresponds to brightness.
Once contrast has been adjusted within the luminance (V) channel, I followed it up by saturating the colors more through modifying the S (saturation) channel. Finally, I apply a simple blur filter to reduce the amount of noise.
Here is a picture of my daughter while she was still an infant.
The image was processed within the RGB color space. The method chosen to color enhance was using the gray world technique.
The method to perform the color enhancement is as follows:
- Take the average of each value in every color channel, obtaining
- Obtain the total sum of all the values in each channel
- Obtain the
averagepixel value by dividing the sum from all channels and the total number of pixels from all channels.
- Using the average, we divide this by the average values found in each channel to obtain
b_alpha. We can think of these as weights
- Then for each pixel in each channel, multiply the value by the corresponding alpha value to obtain the new value.
We can manipulate the colors in an image to give a specific color temperature. For example, by working with the image in the Lab color space, I can make the image more red, or less yellow by adjusting the a, or b channels.
To make the image more red, I can adjust the a channel. I pick a value in this channel that is some threshold value. In this case, pixel values with 120. This would be the threshold. For all values in the a channel, if the pixel value is greater than 120, then it will be adjusted by some factor to make it more red.
The process is similar with making the image less yellow. Instead of addition, it will be subtraction in the b channel.
Bells and Whistles
Color Hybrid Images
For the color hybrid image, I had to tweak the cut off frequencies in order for the colors to be merged properly in the final hybrid image. Otherwise, there will be a lot of artifacts appearing.
It seems to be the case that the low frequency component will always dominate the picture. So, either having the low frequency only as color, or both as color will yield a color result. Having the low frequency as grayscale and high frequency as color will still produce a seemingly grayscale hybrid.
Then, it may make sense to use a grayscale image for the high frequency component of the hybrid image as only edges are retained when a high pass filter is applied on it.
Gaussian and Laplacian Pyramids
For the Laplacian generated images, it is important to remember that pixel values may fall into the negative range. In order to
accommodate for this, and ensure that edges and background are visible, I shifted each pixel by
0.5 before outputting.
This makes it easier to see the edges in the pictures, in general.