AlphaMatte Tool
This program is designed to let you easily extract an Alpha Matte from an
image. It is written in java 1.4, with some support libraries, and may be
downloaded.
It uses two components, the first being
intelligent scissoring, as described by
Eric Mortensen. This is used to allow the user to easily trace lines
around an object by snapping to likely edges, as demonstrated
below.
Starting with the original picture:

We can scissor along the edges:

The next component is the Alpha Matte extraction. Our program uses a
simplified version of
Bayesian Matting, by Yung-Yu Chuang. This algorithm takes in the
original image and a trimap segmentation of the image into known
background, known foreground, and unknown regions. From this, it
calculates likely foreground, background, and alpha values for the
unknown areas. This process is simple within our program, as seen
below.
Assign thicknesses to the edges to create the
trimap:

Then the algorithm chooses alpha values:

And finally we can take the image with alpha and recomposite it:

In order to make composites look natural, it is necessary for all the
elements to have similar lighting conditions. It is possible to make some
corrections digitally, and a simple method has been included in this
program. A background image can be loaded in for compositing (using the
popup menu), then the foreground can be color shifted to match the
background. This is done by looking at min/mean/max of the histogram of
each and then fitting each of the red, green, and blue channels of the
foreground to the background using either a gamma or quadratic curve.
Since the curves perform differently in different situations, the choice
is available in the popup menu. In the image below, you can see the
difference between the original and the color matched version. The
original has a much more yellow tint, while the color matched is harsher
and matches the tone of the background better.
On the right, a non-color matched Mickey, on the left color matching
applied:
In addition to the combined use of the papers mentioned above, we also
included some support for video. The idea for evolving the boundaries
across video frames is rather simple, but works reasonably well. For each
region around a scissoring seed point, a small neighborhood of the next
frame is searched for a best match (using a sum-of-square error metric).
When the locations of all the new seed points are known, the intelligent
scissoring algorithm is applied by computing the minimum cost path between
each of the seeds, creating a boundary that fits the new image. Since
there are no guarantees about accuracy, it is quite simple for the user to
edit a path to correct it. When the sequence has been mapped out, the
user can save the project to be edited later, and save out a sequence of
alpha mapped images for the sequence.
An example of using this process on video:
Downloading
If you would like to try this software, it is available,
here,
in a jar format (178K).
No warrantee expressed or implied; try it out, but don't rely on it
for your important tasks. This jar contains portions
of the
Jama matrix package. From what I make of the licenses, it is OK for
me to redistribute this code as part of my project.
To run this software, simply run 'java -jar Matte.jar' and possibly
include a -Xmx tag to increase java's memory space if you work with large
images or video. Using the java server VM (run java -server) may increase
speed as well.
Comments are welcome;
send them to harlan@cs.washington.edu.