calcHist函数
Calculates a histogram of a set of arrays.spa
计算阵列的直方图。指针
C++: void calcHist(const Mat*images, int nimages, const int* channels, InputArray mask, OutputArray hist, int dims, const int* histSize, const float** ranges, bool uniform=true, boolaccu-orm
mulate=false)element
C++: void calcHist(const Mat*images, int nimages, const int* channels, InputArray mask, SparseMat&hist, int dims, const int* histSize, const float** ranges, bool uniform=true, boolaccu-原型
mulate=false)it
C: void cvCalcHist(IplImage** image, CvHistogram* hist, int accumulate=0, const CvArr*mask=NULL)io
以上是函数原型。form
Parameterssed
images – Source arrays. They all should have the same depth,CV_8U or CV_32F, and the same size. Each of them can have an arbitrary number of channels.
原阵列(由于是指针,能够是一系列图像),应该有相同的深度,8位或32位,可是通道个数能够不一样。
nimages– Number of source images.
原图像的个数。
channels – List of the dims channels used to compute the histogram. The first array channels are numerated from 0 to images[0].channels()-1 , the second array channels are counted from images[0].channels() to images[0].channels() + images[1].channels()-1, and so on.
用来计算直方图的通道。
mask– Optional mask. If the matrix is not empty, it must be an 8-bit array of the same
size as images[i]. The non-zero mask elements mark the array elements counted in the
Histogram.
掩膜板,可选的。若是不为空,它必须是与image同大小的8位的阵列。不为零的mask决定哪些元素参与直方图计算。
hist– Output histogram, which is a dense or sparse dims-dimensional array.
输出的直方图。
Dims - Histogram dimensionality that must be positive and not greater than CV_MAX_DIMS(equal to 32 in the current OpenCV version).
直方图的维数。必须为正,而且不能超过CV_MAX_DIMS(如今是32)。
histSize– Array of histogram sizes in each dimension.
直方图的划分个数。通常取16就能够。
ranges– Array of the dims arrays of the histogram bin boundaries in each dimension.
Reference手册上的解释过于繁琐,我的理解就是竖坐标的显示范围。
uniform– Flag indicating whether the histogram is uniform or not (see above).
通常是缺省的。
accumulate– Accumulation flag. If it is set, the histogram is not cleared in the beginning
when it is allocated. This feature enables you to compute a single histogram from several
sets of arrays, or to update the histogram in time.
通常缺省。