This project is based on the paper Intelligent Scissors for Image Composition, by Eric Mortensen and William Barrett, published in the proceedings of SIGGRAPH 1995. The way it works is that the user first clicks on a "seed point" which can be any pixel in the image. The program then computes a path from the seed point to the mouse cursor that hugs the contours of the image as closely as possible. This path, called the "live wire", is computed by converting the image into a graph where the pixels correspond to nodes. Each node is connected by links to its 8 immediate neighbors. Note that we use the term "link" instead of "edge" of a graph to avoid confusion with edges in the image. Each link has a cost relating to the derivative of the image across that link. The path is computed by finding the minimum cost path in the graph, from the seed point to the mouse position. The path will tend to follow edges in the image instead of crossing them, since the latter is more expensive. The path is represented as a sequence of links in the graph.
After implementing "iscissors", we may use it to select the target rigion, make a mask and finally composite another image via photoshop.
The left-hand images below are the orginal images, and the right-hand images are the corresponding composite production.
Some other examples:
Below are the mask images of avatar "example 1" and lena "example 2".
HK University of Science and Technology, Dept. CSE
HK University of Science and Technology, Dept. ECE