A C++ implementation of alpha-expansion moves using QPBO for minimisation of non-submodular energies.
qpbo_alpha_expand
is inspired by [Shai Bagon's MATLAB wrapper] 1 and uses [Vladimir Kolmogorov's QPBO implementation] 2.
This project was motivated by the need to minimise problems with large label spaces where direct instantiation of the unary and pairwise energy matrices was not possible.
For the problems of interest, the label spaces for each node were also restricted.
This qpbo_alpha_expand
implementation makes use of templates to enable straightforward lazy evaluation of the unary and pairwise energies and restriction of the label spaces.
Author: Richard Stebbing
License: MIT (refer to LICENSE).
As per the license for QPBO, this software can be used for research purposes only.
Python:
- [rstebbing/common] 4
- Numpy
- Scipy
- Extract [QPBO-v1.32.src.zip] 2 to the subdirectory external/ under the project root. All QPBO files should reside under external/QPBO-v1.32.src/.
- Run CMake with an out of source build.
- Set
EIGEN_INCLUDE_DIR
to the full path up to and including eigen3/. (Add-std=c++11
toCMAKE_CXX_FLAGS
if compiling with gcc.) - Configure.
- Build.
- Run example.
- Extract [QPBO-v1.32.src.zip] 2 as above.
- Set
EIGEN_INCLUDE
andCOMMON_CPP_INCLUDE
in site.cfg. - Build the Python extension in place:
python setup.py build_ext --inplace
. (Useexport CFLAGS=-std=c++11
beforehand if compiling with gcc.) - With rstebbing/common installed, run example.py.
To make qpbo_alpha_expand
available to other projects (either globally or under a virtualenv):
- Build:
python setup.py build
. (Useexport CFLAGS=-std=c++11
beforehand if compiling with gcc.) - Install:
python setup.py install
.