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
3) build the mex files, here we are providing only precompiled mexmaci64 (MacOS, 64 bit Matlab)
>> cd mex
[you may need to modify the mexall.m script under Windows OS]
4) Run demo program
>> cd ..
The demonstration program showGmmDEM will only operate on color images
(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
- 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
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.