您的位置:首页 > 运维架构

OpenCv计算直方图cv::calcHist

2016-10-28 21:34 357 查看
直方图,简单通俗的理解,是对图像上像素的统计!统计像素在整个图像上的出现频率!

OpenCv提供的API中有三个计算直方图的函数:

/** @brief Calculates a histogram of a set of arrays.
The functions calcHist calculate the histogram of one or more arrays. The elements of a tuple used
to increment a histogram bin are taken from the corresponding input arrays at the same location. The
sample below shows how to compute a 2D Hue-Saturation histogram for a color image.
**/
CV_EXPORTS 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, bool accumulate = false );

/** @overloadthis variant uses cv::SparseMat for output*/
CV_EXPORTS 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, bool accumulate = false );

/** @overload */
CV_EXPORTS_W void calcHist( InputArrayOfArrays images,
const std::vector& channels, InputArray mask,
OutputArray hist, const std::vector& histSize,
const std::vector& ranges, bool accumulate = false );


参考文献:

[1] OpenCV深入学习(5)--直方图之calcHist使用

[2] OpenCV深入学习(6)--直方图之calcHist使用(补)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: