Image mutual information

版本 1.0.0 (2.6 KB) 作者: Jess Sia
Fast mutual information calculation for images with consistent results to MATLAB built-in entropy() function.
107.0 次下载
更新时间 2023/6/8
MATLAB mutualInfo function
Fast MATLAB function to calculate the mutual information of two images. Designed specifically for speed and to emulate functionality of MATLAB native entropy function. For details on usage, see function docstring or execute help mutualInfo. Based on the mi function created by J. Delpiano.
Requirements and compatibility:
  • Developed and tested in MATLAB 2023a.
  • At least 2021a is required for the name=value syntax function arguments. Replace these with comma-separated syntax (lines 39-43) if you are using a version older than 2021a.
  • At least 2015b is required for the histcounts and histcounts2 functions.
  • Requires the im2uint8 function from the Image Processing Toolbox (lines 30-31.) If this toolbox is not available to you, replace those lines with code that will scale the gray-levels of your image to values in the range of 0 to 255, then cast the images to uint8.
Theory
The mutual information I of two images A and B is given by [1]:
Where is the joint probability density function of the gray-levels of the images, and and are the probability density functions of the gray-levels of images A and B, respectively. It is assumed that .
The information entropy H of an image A is given by [2]:
Where p is the probability density function of the gray-levels of A. The joint entropy of two images A and B is then given by [2]:
And the conditional entropy accordingly by [2]:
The mutual information of the images can then be expressed in terms of entropy by [2]:
The mutual information of an image with itself is then [2]:
Therefore, the mutual information of an image with itself is equal to its entropy. For a given image A in MATLAB, mutualInfo(A, A) will yield a numerical result that is close to but not exactly identical to the result of entropy(A) due to floating point error.
References
[1] F. Maes, D. Loeckx, D. Vandermeulen, and P. Suetens, “Image registration using mutual information,” in Handbook of Biomedical Imaging: Methodologies and Clinical Research, N. Paragios, J. Duncan, and N. Ayache, Eds., Boston, MA: Springer US, 2015, pp. 295–308. doi:10.1007/978-0-387-09749-7_16.
[2] T. M. Cover and J. A. Thomas, “Entropy, Relative Entropy, and Mutual Information,” in Elements of Information Theory, 2nd ed.Hoboken, NJ: Wiley-Interscience, 2006, pp. 13–55.

引用格式

Jess Sia (2025). Image mutual information (https://github.com/jessthespacer/mutual-info-matlab/releases/tag/v1.0.0), GitHub. 检索时间: .

MATLAB 版本兼容性
创建方式 R2023a
与 R2021a 及更高版本兼容
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库