Description
This is the sample implementation of a Markov random field based color image segmentation algorithm described in the publication below. Note that the current demo program implements only a supervised version of the segmentation method described in the referenced paper (i.e. parameter values are learned interactively from representative regions selected by the user). Otherwise, the program implements exactly the color MRF model proposed in the paper. Images are automatically converted from RGB to the perceptually uniform CIE-L*u*v* color space before segmentation. The main code (colormrf.cpp) has been written by Mihaly Gara with some minor contributions from Zoltan Kato using the intenisty-based segmentation code of Csaba Gradwohl. The program uses the Mersenne Twister random number generator written by Agner Fog. The generator itself is described in the following paper: - M. Matsumoto and T. Nishimura. Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator. ACM Transactions on Modeling and Computer Simulation Vol. 8, No. 1, January pp.3-30 (1998).
Installation The code is platform independent. We have succesfully compiled it under Linux (RedHat, Fedora, Debian) and Windows (XP, 2003 server). Usage Notes The program works on BMP images. Some test images are provided under the images subdirectory. The program GUI should be intuitive. Main steps: - Load a color image.
- Enter the number of pixel classes (~region type).
- Push Select classes button.
- Press left mouse button over the input image and draw a rectangle over a representative region of the first class. Then push Next class button. The mean and variance-covariance should appear in the Class parameters window. Continue with the next class until a representative rectangle for all classes has been selected.
- Set the weight of doubleton potentials (default is 2.5) and the stopping threshold (iterations are stopped when the energy change is less than the specified value).
- Choose the optimization method from the pull-down list.
- Adjust the optimization method's parameters: T0 - Initial temperature; c - temperature scheduler (T(n+1) = c*T(n)); alpha - MMD's probability threshold.
- Push Do it >> button to execute segmentation.
- Optionally, you can save the segmentation result as a BMP image.
During segmentation, the current classification along with the temperature and global energy are displayed at each iteration. At the end, the elapsed CPU time (excluding GUI overhead!) is also displayed. Download Full source and precompiled binaries are available as a gziped tar or zip archive.
License
The code is released under the GNU General Public License.
|