Interactive Segmentation Tool-Box
An implementation of ‘Lazy Snapping’ and ‘GrabCut’: Based on Interactive Graph Cuts
Lazy Snapping  and GrabCut  are 2D image segmentation tools based on the interactive graph-cuts technique proposed by Boykov and Jolly . Lazy Snapping requires the user to specify foreground and background seeds, and performs 2D segmentation with the seeds as hard constraints. GrabCut makes the process more automatic by using iterated graph cuts – the only user interaction required is a bounding box of the foreground object.
We provide an implementation of both these tools, along with a third tool which combines both these methods. Our code uses the maxflow code  by Vladimimr Kolmogorov.
<![if !vml]><![endif]> <![if !vml]><![endif]> <![if !vml]><![endif]>
Requires MATLAB and mex (C++) compiler. You will need kmeans on MATLAB to run the code. Refer the README file for compilation instructions.
Our Segmentation Tool can be used to perform segmentation on huge image databases. As an example, we provide results of using the Grab Cut Tool on a subset of the PASCAL data set  (a few different Object Classes). We use the Bounding Boxes available along with this set to seed our iterative graph cuts algorithm. The parameters given in the parameter file can be fine-tuned to achieve desirable segmentations.
Note: The coarseness around the boundary of the segmented results is due to the fact that the code runs segmentation on water-shed super-pixels instead of pixels, for efficiency purposes. Using super-pixels, we achieve a significant speed-up at the cost of slight loss of accuracy.
 Interactive Graph Cuts for Optimal Boundary & Region Segmentation of Objects in N-D Images. Boykov & Jolly, ICCV 2001 [PDF]
 Lazy Snapping. Yin Li, Jian Sun, Chi-Keung Tang, Heung-Yeung Shum, SIGGRAPH 2004 [PDF]
 GrabCut — Interactive Foreground Extraction using Iterated Graph Cuts. Rother, Kolmogorov & Blake, SIGGRAPH 2004 [PDF]
For questions/comments about the code, please contact:
Mohit Gupta – firstname.lastname@example.org
Krishnan Ramnath – email@example.com
You can post your comments/questions here
This project was done as part of the Advanced perception class at the Robotics Institute, CMU. Class Instructor: Alexei Efros