imhist
Histogram of image data
Syntax
Description
[
calculates the histogram for the grayscale image计数
,binLocations
] = imhist(I
)I
。这imhist
function returns the histogram counts in计数
和bin位置binLocations
。这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
。这直方图has one bin for each entry in the colormap.
Examples
Input Arguments
Output Arguments
Tips
For grayscale images, the
n
直方图的垃圾箱是宽度的每个半开关间隔A/((n-1)。In particular, thepthbin is the half-open intervalwherexis the intensity value. The scale factorA和偏移B取决于图像类的类型如下:
数据类型 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
计数
和binLocations
,使用命令
。stem
(binLocations,counts)