C++OpenCV下绘制直方图
直方图的定义:灰度直方图是对一幅灰度图像素分布的统计。对于一幅8Bit量化的图像来说。就是统计在0~255各个灰度级上,像素点的个数或者密度。
在OpenCV库提供了
calcHist()方法用于得到图像的直方图。
具体函数的调用方法如下:
void cv::calcHist(const Mat*images,int nimages,const int *channels,InputArrary mask,OutputArrary hist,int dims,const int* histSize,const float **ranges,bool uniform=true,bool accumulate=false)
//参数说明
//images:带统计直方图的图像数组
//nimages:输入图像的数目
//channels:需要统计的通道索引数组 一般灰度图就是