mutual_information(i1, i2, bins=256)¶
Computes the mutual information (MI) (a measure of entropy) between two images.
MI is not real metric, but a symmetric and nonnegative similarity measures that takes high values for similar images. Negative values are also possible.
Intuitively, mutual information measures the information that
i2share: it measures how much knowing one of these variables reduces uncertainty about the other.
The Entropy is defined as:\[H(X) = - \sum_i p(g_i) * ln(p(g_i)\]
with \(p(g_i)\) being the intensity probability of the images grey value \(g_i\).
Assuming two images \(R\) and \(T\), the mutual information is then computed by comparing the images entropy values (i.e. a measure how well-structured the common histogram is). The distance metric is then calculated as follows:\[MI(R,T) = H(R) + H(T) - H(R,T) = H(R) - H(R|T) = H(T) - H(T|R)\]
A maximization of the mutual information is equal to a minimization of the joint entropy.
i1 : array_like
The first image.
i2 : array_like
The second image.
bins : integer
The number of histogram bins (squared for the joined histogram).
mutual_information : float
The mutual information distance value between the supplied images.
If the supplied arrays are of different shape.