540 Project: Graph Cuts


Brad Bingham
December 2005

For my project, I implemented a graph cuts algorithm for minimizing energy functions in Matlab and used it for exact inference on 2D binary lattice MRFs. This is based on results from What Energy Functions can be Minimized via Graph Cuts? (Kolmogorov and Zabih) and C++ code found here. I also used an M-File MaxFlows.m from a graph theory toolbox written by Sergiy Iglin (GrTheory, found at the Matlab Central File Exchange) and some demo/BP code borrowed from Kevin Murphy.

Downloads: Project code: gc.zip

This contains 4 directories: Demos:

Make sure the above directories are in your Matlab path. This code was tested with Matlab version 7.0.1.24704 (R14) SP1 and Microsoft Visual C++ .NET version 1.1.4322.
  1. gc_image_demo: For 4 different black and white pixel images (32 by 32 to 40 by 40), images have 10% of their pixels changed, then graph cuts is run to recover the image with a local potential of 0.9 for a matching assignment to the observed (and 0.1 for not matching) and a kernel of [.75 .25; .25 .75]. Displays before, noised, and after figures for each image.
  2. demo_lattice: Modified version of Kevin's demo to compare BP to graph cuts.
  3. gc_random_demo: graph cuts is run on a 7 by 7 lattice with hard coded local potentials and kernal. The resulting 0-1 matrix is output. To check that this matches the output of the C++ version of graph cuts, open C++\GraphCuts2\GraphCuts2.vcproj. In Visual Studio select Debug -> Start without debugging (build if neccessary). The output in the console window should match the output of gc_random_demo. This comparison can be done on random, not hard coded potentials by following the procedure described in the block comment in gc_random_demo.m.
Graph Cuts Computation:

A brief description of graph cuts M-Files and the steps of computation:
Pictures:

Output from gc_image_demo (original 'X' courtesy of Mark Schmidt):



Output from demo_lattice:


Last Updated: December 11th, 4:42 PM, 2005