File Exchange

image thumbnail


version (812 KB) by Quan Wang
Implementation of the Hidden Markov Random Field Model and its Expectation-Maximization Algorithm


Updated 08 Jul 2018

View License

In this project, we study the hidden Markov random field (HMRF) model and its expectation-maximization (EM) algorithm. We implement a MATLAB toolbox named HMRF-EM-image for 2D image segmentation using the HMRF-EM framework. This toolbox also implements edge-prior-preserving image segmentation, and can be easily reconfigured for other problems, such as 3D image segmentation.

Comments and Ratings (8)

Quan Wang

Hi Lijie,

Document is here:

Lijie Yu

Is there a corresponding article in this code?


Can this code be applied to images with more than one channel, i.e. where each pixel is characterized by more than one gray value?


dag (view profile)

Compiling the mex files seems to have made most morphological image processing (imopen, imclose, etc.) functions unstable and continue to crash MATLAB. Any suggestions?


Balu (view profile)


How can i use this for multispectral classification with PCA ?


Siqi (view profile)



Octa (view profile)

The program is working properly.

Can you suggest how to apply it for segmenting gray matter from an MRI Scan Image?

Thank you.


Add link to document.

Rewrote several minor parts in C++.

Minor bugs have been fixed.

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

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor