Skip to content

Implement Hybrid Images paper by Oliva, Torralba and Shyns, from SiGGRAPH 2006.

Notifications You must be signed in to change notification settings

KnownSubset/CSE559-HybridImages

Repository files navigation

#Algorithm, results, and any decisions you made to code your algorithm a particular way.


##Algorithm

  1. Obtain the high frequency parts of one image by filtering image with Gaussian Filter.

    >%Image is already available
    >hs =50;
    >fftsize = 1024;
    >%The cutoff frequency ends up being implemented as the "sigma" that defines the Gaussian filter, and is a parameter that you have to play with to make the output images better
    >Gaussian = fspecial('gaussian', hs*2+1, sigma);
    >FftGaussian = fft2(Gaussian, fftsize, fftsize);
    >FftImage = fft2(Image, fftsize, fftsize);
    >ImageFiltered = ifft2(FftImage .* FftGaussian);
    >GaussianImageFiltered = ImageFiltered(1+hs:size(Image,1)+hs, 1+hs:size(Image,2)+hs);
  2. Obtain the low frequency parts of another image by filtering image with Laplacian Filter.

    >%Image is already available
    >hs =50;
    >fftsize = 1024;
    >%The cutoff frequency ends up being implemented as the "sigma" that defines the Gaussian filter, and is a parameter that you have to play with to make the output images better
    >Gaussian = fspecial('gaussian', hs*2+1, sigma);
    >FftGaussian = fft2(Gaussian, fftsize, fftsize);
    >FftImage = fft2(Image, fftsize, fftsize);
    >ImageFiltered = ifft2(FftImage .* FftGaussian);
    >ImageFiltered = ImageFiltered(1+hs:size(Image,1)+hs, 1+hs:size(Image,2)+hs);
    >%Laplacian Filter Image can be generated by taking the Image matrix subtracting the values from the same image filtered by a Gaussian Filter.
    >LaplacianFilteredImage = Image - ImageFiltered;
  3. Generate Hybrid Image by adding the values of the images matrixes together

    >HybridImage = GaussianImageFiltered + LaplacianFilteredImage;

This general outline of the algorithm was used to generate the hybrid images as you can see by checking out the files located on this site. The only part of the process that needed careful tweaking is the cutoff frequency.

##Results

  • Favorite two results

    I tried to find images that would have the same general shape when scaled to be roughly within a 1/3 size difference. For some of the images below I had to obtain a size ration of 1:1 like with the Buffalo Bill and skull. Other aspects of the items in the images could mitigated through rotation or cropping. Ideally one image subject would encompass the other image subject. Throughout the process I had to modify the values used for sigma, the cutoff frequency, to increase/reduce the amount of the image feature used in the hybrid image so that the interpretation would be a function of the viewing distance.


HotDog Hybrid Hot Dog used as Low Frequency Dog as Hot Dog used as High Frequency


Guitar Hybrid Ukulele used as Low Frequency Guitar used as High Frequency


  • At least two more results, including on that doesn't work very well (a failure example). Explain why the good results were so, and why the failure case

These two images are able to produce a hybrid image that works reasonably well. The results would work better if the angle of the skull and the body were aligned. There were no images of full skeleton in a similiar pose to the one of Buffalo Bill that would have made a better hybrid image. Or if I could have found the skeleton minus the skull, the hybrid of person and the skeletal frame outline would produce a good hybrid.

Buffalo Bill Hybrid Old-timey Buffalo Bill Skull


The two batmobile images did not produce a reasonable hybrid. Each image contains features that are not encompassed by the other image. For instance, the wheel wells, nose, and tailfins were larger on the newer batmobile and more pronounced. The width of the older batmobile was larger than the newer batmobile.

Batmobile badly filtered Batmobile Old-timey Batmobile


  • Extensions

    I made a compelling hybrid image from two different images of the same scene. There was no need to try and align the images since they came from the same scene; all the work revolved around altering the the cut-off frequency. I had to ensure that the outline of the folliage came through in the hybrid and that the folliage did not obsurce the branches. The images came from Eirik Solheim's gallery The four seasons in Norway 10mm HDR

Summer Fall Hybrid Summer Fall

About

Implement Hybrid Images paper by Oliva, Torralba and Shyns, from SiGGRAPH 2006.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages