Python wrappers for GCO alpha-expansion and alpha-beta-swaps. These wrappers provide a high level interface for graph cut inference for multi-label problems.
See my blog for examples and comments: peekaboo-vision.blogspot.com
Download and install Cython (use your package manager).
Run example.py for a simple example.
Make sure Cython is installed (included in enthought Python distribution for example)
Download original source from http://vision.csd.uwo.ca/code/gco-v3.0.zip
Build gco with your compiler of choice. Create a dynamic library at libgco.so.
Adjust the path to gco in setup.py.
python setup.py build.
run example.py for a simple example.
There have been some problems compiling gco (not my wrappers) using gcc4.7. Please install gcc-4.6 and adjust the call in Makefile accordingly.
GCO implements alpha expansion and alpha beta swaps using graphcuts. These can be used to efficiently find low energy configurations of certain energy functions. Note that from a probabilistic viewpoint, GCO works in log-space.
Note that all input arrays are assumed to be in int32. This means that float potentials must be rounded!
These algorithms can only deal with certain energies. Unfortunately I have not figured out yet how to convert C++ errors to Python. If an unknown error is raised, it probably means that you used an invalid energy function. Look at the gco README for details.
This package gives a high level interface to gco, providing the following functions:
Graph cut on a 2D grid using a global label affinity-matrix.
NOT DONE YET
Graph cut on a 2D grid using a global label affinity-matrix and edge-weights.
V contains the weights for vertical edges,
H for horizontal ones.
Graph cut on an arbitrary graph with global label affinity-matrix.
NOT DONE YET
Graph cut on an arbitrary graph with global label affinity-matrix and
example_middlebury.py for examples and the gco README
for more details.