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.
通常缺省。