# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# entropy

Entropy of grayscale image

E = entropy(I)

## Description

E = entropy(I) returns E, a scalar value representing the entropy of grayscale image I. 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. By default, entropy uses two bins for logical arrays and 256 bins for uint8, uint16, or double arrays.

I can be a multidimensional image. If I has more than two dimensions, the entropy function treats it as a multidimensional grayscale image and not as an RGB image.

## Class Support

I can be logical, uint8, uint16, or double and must be real, nonempty, and nonsparse. E is double.

## Notes

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.

## Examples

collapse all

Read image into the workspace.

I = imread('circuit.tif');

Calculate the entropy.

J = entropy(I)
J = 6.9439

## References

[1] Gonzalez, R.C., R.E. Woods, S.L. Eddins, Digital Image Processing Using MATLAB, New Jersey, Prentice Hall, 2003, Chapter 11.

## See Also

#### Introduced before R2006a

Was this topic helpful?

Download now