A contrario segmentation: Acsegmentor
Acsegmentor aims at segmenting gray-level images into homogeneous regions. It’s a generic algorithm: it requires a distance function between regions, an exploration heuristic and automatically find thresholds ensuring that regions in the final partitions will be statistically meaningfully different. This step is done using a contrario reasoning: two regions are meaningfully different is the probability that the exploration heuristic find such different regions in pure noise is very low. This ensures that in the final partition, statistically, regions difference are not due to chance but are a result of some physical phenomena, such as different objects in the scene.
Acsegmentor comes with an example of distance function which analyzes frontier contrast, gray level distributions and deviations differences between couples of regions. It also comes with a simple exploration heuristic, which, starting with a initial partition, iteratively merges the least different regions until only meaningful couples of regions remain.
Two algorithms are implemented to provide to initial partitions: classical watershed (Vincent & Soille) and the algorithm of P. Felzenszwalb and D. Huttenlocher published in the IJCV paper “Efficient Graph-Based Image Segmentation” (authors’ webpage), called EGBIS here.
- Version 0.2a (18 January 2009)
- Version 0.1 (14 September 2007)
- Source acsegmentor-0.1.0-Source.tar.bz2 or acsegmentor-0.1.0-Source.zip (bigger)
- Linux binaries
- Mac OS X binaries
- Intel (tested on Tiger 10.4.10): acsegmentor-0.1.0-Darwin.zip
- Windows binaries (32bits, tested with VC8 and mingw with WinXP): acsegmentor-0.1.0-Windows.zip
Acsegmentor uses CMake (http://www.cmake.org) to generate Makefiles, KDevelop, XCode or VisualStudio projects. Once cmake is installed, you just need to run it on the root directory of the source tree. It is available in most Linux distributions.
Acsegmentor also depends upon VXL (http://vxl.sourceforge.net), Boost (http://boost.org) and Juce (http://www.rawmaterialsoftware.com/juce/). These libraries are embedded in the source tree to avoid extra installations and to make sure that you have a compatible version.
- Example on Unix
$ mkdir build $ cd build $ ccmake /path/to/acsegmentor-0.1-Source => Console based-interface => Type 'c' (configure, maybe twice) and then 'g' (generate) to create Makefiles. => You might want to change build settings. For example, to enable both optimizations and debugging symbols, enter `RelWithDebInfo' in CMAKE_BUILD_TYPE. For the fastest binaries, enter `Release'. $ make $ src/acsegmentor => should be ok
- There are a console mode and a GUI mode. Use it without command line parameters
for the GUI version, or type
acsegmentor --helpto find the (numerous) available command line options.
- There are a console mode and a GUI mode. Use it without command line parameters for the GUI version, or type
- Segmentation examples
$ acsegmentor --image lena.pgm => segment the image lena, resulting segmentation is in `output.pgm'. => use default parameters: a contrario segmentation with MergeBest exploration heuristic and egbis initialization with sigma=0.8 K=150 minsize=20 $ acsegmentor --image lena.pgm --output myoutput.pgm --initializer watershed => idem as above with a watershed initialization with default parameters (sigma=0.8), result is in `myoutput.pgm' $ acsegmentor --image bigimage.pgm => Exception raised because no thresholds can be found. => Thresholds were pre-computed for some 256x256 images. For other sizes, you have to learn new thresholds (see LEARNING EXAMPLES). $ acsegmentor --image bigimage.pgm --output output.pgm --sigma 1.1 => Exception raised because no thresholds can be found. => Specific thresholds must be computed for each parameter. Pre-computed thresholds are given only for default parameters. => You have to run a learning process. $ acsegmentor --image bigimage.pgm --output output.pgm \ --threshold-database thresholds.xml => Read additional thresholds from `thresholds.xml'. These thresholds can be generated automatically by the learning phase.
- Learning examples
$ acsegmentor --learn --threshold-database thresholds.xml \ --width 1024 --height 1024 \ --nb-iterations 1000 => Learn thresholds for 1024x1024 images for an egbis initializer. => 1000 noise images will be analyzed to deduce statistical thresholds. => Resulting thresholds will be put into `thresholds.xml'. This file can then be used to segment new 1024x1024 images.
|“House” image||Watershed (1839 regions)||Filtered (54 regions)|
|Egbis (267 regions)||Filtered (36 regions)|
|“House” image||Egbis (1867 regions)||Filtered (9 regions)|