Examples

Calculate Entropy of Grayscale Image

Input Arguments

I — Grayscale imagereal, nonsparse numeric array

Grayscale image, specified as a real, nonsparse numeric array.
I can have any dimension. If I
has more than two dimensions, entropyfilt treats it as a
multidimensional grayscale image and not as a truecolor (RGB) image.

Output Arguments

e — Entropynumeric scalar

More About

Entropy

Entropy is a statistical measure of randomness that can be used
to characterize the texture of the input image.

Entropy is defined as -sum(p.*log2(p)), where p contains the normalized histogram
counts returned from imhist.

Tips

By default, entropy uses two bins for logical arrays and
256 bins for uint8, uint16, or
double arrays. entropy converts any
class other than logical to uint8 for the
histogram count calculation so that the pixel values are discrete and directly
correspond to a bin value.