Function File: imhist (I)
Function File: imhist (I, n)
Function File: imhist (X, cmap)
Function File: [counts, x] = imhist (…)

Produce histogram counts of image I.

The second argument can either be n, a scalar that specifies the number of bins; or cmap, a colormap in which case X is expected to be an indexed image. If not specified, n defaults to 2 for binary images, and 256 for grayscale images.

If output is requested, counts is the number of counts for each bin and x is a range for the bins so that stem (x, counts) will show the histogram.

Note: specially high peaks that may prevent an overview of the histogram may not be displayed. To avoid this, use axis "auto y" after the call to imhist.

See also: hist, histc, histeq.

Package: image