Hybrid Images
Benjamin Leib
bgleib
This project implements hybrid images using Laplacian pyramids, combining two images into a single image whose low frequencies come from one of the input image and high frequencies come from the other. The program first aligns the two images using the supplied code. It then generates Gaussian and Laplacian pyramids for both input images using the recursive Pyramids function. This function, given an input image I, applies a low-pass (Gaussian) filter of size 18x18 with standard deviation 3.0 to the image, creating H, the first level in the Gaussian pyramid. It then subtracts H from I to create L, the first level in the Laplacian pyramid. It then calls itself recursively, passing in H as the new value for I. It goes through eight recursive calls, creating eight images in each of the Gaussian and Laplacian pyramids. This is done for both original input images. Note that unlike classic image pyramids, I do not downsample the images at each step, as I found this complicated the algorithm without changing the output. Downsampling would decrease the computational cost, but I did not run into any computational limitations.
Once both pairs of pyramids have been generated for the input images I1 and I2, the hybrid image is created by pixel-wise adding together of the last level of the Gaussian pyramid for I1 (the most blurry, containing all the lowest frequencies), plus the last N levels of the Laplacian pyramid for I1, plus the first 8-N levels of the Laplacian pyramid for I2. Thus the hybrid images is the result of adding together 9 images, 1 from a Gaussian pyramid of I1 and 8 from the Laplacian pyramids of I1 and I2. This setup creates a hybrid image with low-frequencies from I1 and high-frequencies from I2. N was chosen on a per-case basis based on experimentation, with larger values resuling in hybrid images that were more skewed towards I1.
Below are three hybrid images generated by my program from the supplied input images. For each, the first image on the left is the one used for the low-frequencies, and the second is the one used for the high-frequencies. The result is shown in two different sizes to illustrate how at large scales the high-frequencies predominate, while at small scales the low-frequencies are more visible.
![]() |
![]() |
![]() |