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.


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:

    load Fig4_features.mat
  • Run the sampler:

  • Same without smoothing (lambda = 0):

  • Smoothing and edge information:

  • 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


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

  • image=imread('image_filename.bmp','BMP');
  • edgemap=imread('edgemap_filename.bmp','BMP');
  • Features=fext(image,8,2,2,edgemap);