entropy [InformationTheory] [image]
— Function File: E = entropy (im)
— Function File: E = entropy (im, nbins)

Computes the entropy of an image.

The entropy of the elements of the image im is computed as

          E = -sum (P .* log2 (P)

where P is the distribution of the elements of im. The distribution is approximated using a histogram with nbins cells. If im is logical then two cells are used by default. For other classes 256 cells are used by default.

When the entropy is computed, zero-valued cells of the histogram are ignored.

See also: entropyfilt