Contour cut: Identifying salient contours in images
Direct questions to Ryan Kennedy: kenry@cis.upenn.edu.
Related Papers
Contour cut: identifying salient contours in images by solving a Hermitian eigenvalue problem. R. Kennedy, J. Gallier, and J. Shi. CVPR 2011. [pdf] [Supplementary Material] [Poster]
Untangling Cycles for Contour Grouping. Qihui Zhu, Gang Song and Jianbo Shi. IEEE International Conference on Computer Vision (ICCV). 2007.
[pdf]
[tech report]
[talk slides]
MATLAB code
The latest version of the MATLAB code can be dowloaded from here (last updated 12/24/2010).
Greedy algorithm: In this code, we have also included an algorithm called "greedy" which was not described in the paper. This is currently the default algorithm. Rather than solving an eigenvalue problem, this algorithm greedily optimizes our objective function by sampling many edge points and extending them until the cost function no longer increases. This algorithm is significantly faster and less memory intensive but may result in lower-quality contours.
Cost function computation: The contours output by our code are currently not necessarily given in order of the cost function value. To evaluate the cost function value of contours, use the following code: contour_cost.m
Step-by-step code use
Begin by downloading the above code and unzipping the archive.
Open MATLAB and navigate to the directory where the code was unzipped.
If you need to compile the code, run the script "compile_all.m". Most users can skip this step.
Execute the "startup.m" script in MATLAB. This will add the appropriate directories to your MATLAB path.
Execute the "contour_demo.m" script. This file demonstrates the use of the contour grouping code.
The output of the contour_demo.m script should look similar to the following:
>> >> contour_demo
Computing Pb
[........]
[........]
[........]
[........]
Elapsed time is 30.476208 seconds.
Finding local maxima
500/500, 100.000000%
Elapsed time is 148.471599 seconds.
Elapsed time is 180.556787 seconds.
After the script has run, there will be two figures:
The first figure plots all contours on the image:
The second figure shows all contours and all image edges. This figure allows you to click on individual contours by left-clicking and cycle through different sets of contours by right-clicking: