Image mutual information
Version 1.0.0 (2,6 KB) von
Jess Sia
Fast mutual information calculation for images with consistent results to MATLAB built-in entropy() function.
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.
Zitieren als
Jess Sia (2024). Image mutual information (https://github.com/jessthespacer/mutual-info-matlab/releases/tag/v1.0.0), GitHub. Abgerufen.
Kompatibilität der MATLAB-Version
Erstellt mit
R2023a
Kompatibel mit R2021a und späteren Versionen
Plattform-Kompatibilität
Windows macOS LinuxTags
Quellenangaben
Inspiriert von: Fast mutual information of two images or signals
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.0.0 |
Um Probleme in diesem GitHub Add-On anzuzeigen oder zu melden, besuchen Sie das GitHub Repository.
Um Probleme in diesem GitHub Add-On anzuzeigen oder zu melden, besuchen Sie das GitHub Repository.