DEM: Diffused expectation maximisation for image segmentation

Color image segmentation using a variant of the Expectation-Maximization (EM) algorithm.
2.3K Downloads
Updated 18 Jun 2012

View License

Description: The code is a simple Demo of the Diffused Expectation Maximisation (DEM) algorithm

for image segmentation as described in the paper

G Boccignone, M Ferraro, P Napoletano (2004). "Diffused expectation maximisation for image segmentation", Electronics letters 40 (18), 1107-1108.

The method classically models a color image as a finite Gaussian mixture, where each mixture component corresponds to a region class and uses a maximum likelihood approach to estimate the parameters of each class, via the expectation maximisation (EM) algorithm, coupled with anisotropic diffusion on classes, in order to account for the spatial dependencies among pixels.

To create the software library and run the demos:

1) unpack the compressed zip file in your working directory and cd to such directory

you will find the following directories:

- /visualization: some visualization tools

- /mex: mex files

- /img: color images to be processed

- /results: to store segmentation results

- /doc: the EL paper

2) download and install the netlab package in the same directory

(http://www.ncrg.aston.ac.uk/netlab/index.php)

3) build the mex files, here we are providing only precompiled mexmaci64 (MacOS, 64 bit Matlab)

>> cd mex

>> mexall

[you may need to modify the mexall.m script under Windows OS]

4) Run demo program

>> cd ..

>> showGmmDEM

The demonstration program showGmmDEM will only operate on color images

The script:

(1) loads a color image from the img directory

(2) runs a classic Expectation-Maximization based segmentation by calling the Netlab function gmmem()

(3) runs the DEM variant by calling the function gmmdem()

(4) displays the segmentation outputs together with the original image

Main functions:

- gmmdem(): this implements the DEM algorithm. Basically a variant of the Netlab gmmem function implementing Expectation Maximization for learning a Gaussian Mixture Model. Here a D-step is interleaved with the E-step and M-step of the classic EM algorithm All parameters are the same as netlab gmmem except for diffoptions, the structure storing the diffusion parameters:

- diffoptions.iter: number of iterations for the D-step

- diffoptions.kappa: Perona-Malik equation conduction coefficient 20-100

- diffoptions.lambda: Perona-Malik equation: discrete step, max value of .25 for stability

- diffoptions.PeronaMalikEq: Setting the diffusion type:

= 1 Diffusion equation 1 favours high contrast edges over low contrast ones.

= 2 Diffusion equation 2 favours wide regions over smaller ones

- normalise() and related mex functions: these are from Kevin Murphy KPMtools

- sc(), label(): visualization functions

Cite As

Giuseppe Boccignone (2024). DEM: Diffused expectation maximisation for image segmentation (https://www.mathworks.com/matlabcentral/fileexchange/37197-dem-diffused-expectation-maximisation-for-image-segmentation), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0