imhist
Histogram of image data
Syntax
Description
[ calculates the histogram for the
grayscale image counts,binLocations]
= imhist(I)I. The imhist function
returns the histogram counts in counts and the bin
locations in binLocations. The number of bins in the
histogram is determined by the image type.
[
specifies the number of bins, counts,binLocations] = imhist(I,n)n, used to calculate the
histogram.
[
calculates the histogram for the indexed image counts,binLocations] = imhist(X,cmap)X with
colormap cmap. The histogram has one bin for each entry in
the colormap.
Examples
Input Arguments
Output Arguments
Tips
For grayscale images, the
nbins of the histogram are each half-open intervals of width A/(n−1). In particular, the pth bin is the half-open intervalwhere x is the intensity value. The scale factor A and offset B depend on the data type of the image as follows:
Data Type A B double10single10int8255128int1665,53532,768int324,294,967,2952,147,483,648uint82550uint1665,5350uint324,294,967,2950logical10To display the histogram from
countsandbinLocations, use the command.stem(binLocations,counts)

