# Code and Data: IJCV 2006

Nonparametric Bayesian Image Segmentation'', P Orbanz and JM Buhmann, IJCV 2008.

[TGZ File]

The code requires a matlab installation including the matlab statistics toolbox, since generation of gamma samples is required to sample the Dirichlet distribution.

## Contents

Matlab code for sampling and feature extraction (directory matlab):

• mdpmrfsample - Samples the posterior or the multinomial/Dirichlet MDP model as described in the paper, both with and without MRF smoothing.
• fext - Histogram feature extraction. Extracted features used for the experiments shown in the report are provided with the data.
• bmmsample - Samples a multinomial/Dirichlet Bayesian mixture model (the parametric counterpart to the unconstrained MDP model). Used for the stability comparison.
• bmm_stability - Stability wrapper for the Bayesian mixture model.

Data sets (subdirectory data):

• Digital images for all figures, numbered as in the report (Fig*_image.bmp).
• Canny edgemaps are provided for SAR and MRI images (though used only for Fig. 10 in the report). The edgemaps are BMP images (Fig*_edgemap.bmp).
• Extracted features as matlab matrices (Fig*_features.mat).

Acknowledgement. The stability code used by bmm_stability was written by Simon Meier at ETH Zurich. The MDP sampler uses a sampling routine for Dirichlet distributions copied from the Fastfit package by Tom Minka.

## Example usage

The functions are detailed by matlab help texts. Please use e.g.
help mdpmrfsample to print usage information.

• In matlab, load a feature set from disk:

• Run the sampler:

M=mdpsample(feature_set,1E-5);
• Same without smoothing (lambda = 0):

M=mdpsample(feature_set,1E-5,'lambda',0);
• Smoothing and edge information:

M=mdpsample(feature_set,1E-5,'edges',1);
• To visualize the result:

imshow(M/max(max(M))); colormap(jet);
• Without the Matlab image processing toolbox (which provides imshow()), results may be visualized with

imagesc(M/max(max(M)));

### Feature extraction:

Extracted features as used in the experiments are contained in the TGZ archive. All histograms were extracted on a 2x2 regular grid with a histogram window radius of 2 (ie 5x5 windows). We used 4 histogram bins for the Corel images (Figs. 2,3) and 8 histograms for all other images.
The corresponding feature extraction calls are