samhat-SunsetSelf.jpg

Seam Stitching - Image Blend Tool

I have written a “seam stitching” program in C++ that joins together two images along a simple, unobtrusive seam.

Seam Stitching

 

I have written a “seam stitching” program in C++ that joins together two images along a simple, unobtrusive seam.

 
My art piece, Self-Portrait at Sunset, uses my seam stitching program to join an old snapshot of mine together with itself.

My art piece, Self-Portrait at Sunset, uses my seam stitching program to join an old snapshot of mine together with itself.

 

In this project, I have built upon ideas from the computer graphics research papers "Image Quilting for Texture Synthesis and Transfer" by Efros and Freeman (ACM Digital Library, homepage) and the later "Seam Carving for Content-Aware Image Resizing" by Avidan and Shamir (ACM Digital Library, homepage). These papers use the idea of a "minimum-error boundary cut," where a "seam" across the image is found that minimizes some energy function. I decided to use this "seam carving" idea to create a program that allows me to join together two arbitrary images along a seam where the two images are most similar, effectively hiding the transition between images.

To be more specific, given two images and the number of pixels by which they should overlap, the program attempts to find a path where the total difference between color values of the pixels along the path is minimized.

Starting at each pixel along the top edge of the overlap region, a greedy algorithm builds a candidate path by iteratively selecting the best short-term option from the 3 pixels directly ahead: south, southeast, and southwest. The candidate path with the lowest total color difference is then selected as the transition seam.

The program then stitches the images together along that seam, without using any additional processing to mask the seam.

 

Demonstration

I also rigged and animated the monster’s shadow, using 2D shadow puppet illustrations created by another team member.

For example, we can stitch together these two forest images, sourced from the internet and taken at completely different locations.

 

Running my program with the two source images above results in this convincingly seamless forest image. See below for a version where the seam is highlighted in pink.

 
In this version of the final image, the seam between the two images is highlighted in pink.