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 Version History

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.

Cite As

Quan Wang (2021). HMRF-EM-image (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

gyuyoung Hwang

Thank you so much!

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?


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



How can i use this for multispectral classification with PCA ?




The program is working properly.

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

Thank you.

MATLAB Release Compatibility
Created with R2008b
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!