Histogram of image data
[
calculates the histogram for the grayscale image计数
,binLocations
] = imhist(I
)I
。这imhist
function returns the histogram counts in计数
和垃圾箱位置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.
For grayscale images, then
直方图的垃圾箱是宽度的半开放间隔A/(n-1)。In particular, thepthbin is the half-open interval
wherexis 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
(宾馆,计数)