imhist
Histogram of image data
Syntax
Description
[
calculates the histogram for the grayscale image计数
,binLocations
] = imhist(I
)I
. Theimhist
function returns the histogram counts in计数
and the bin locations inbinLocations
. The number of bins in the histogram is determined by the image type.
[
specifies the number of bins,计数
,binLocations
] = imhist(I
,n
)n
, used to calculate the histogram.
[
calculates the histogram for the indexed image计数
,binLocations
] = imhist(X
,cmap
)X
with colormapcmap
. The histogram has one bin for each entry in the colormap.
Examples
Input Arguments
Output Arguments
提示
For grayscale images, the
n
bins of the histogram are each half-open intervals of widthA/(n−1). In particular, thepthbin is the half-open intervalwherexis the intensity value. The scale factorAand offsetBdepend on the type of the image class as follows:
Data Type A B double
1
0
single
1
0
int8
255
128
int16
65,535
32,768
int32
4,294,967,295
2,147,483,648
uint8
255
0
uint16
65,535
0
uint32
4,294,967,295
0
logical
1
0
To display the histogram from
计数
andbinLocations
, use the command
.stem
(binLocations计数)