C++ 获取C+中灰度图像的直方图+;在opencv中
我试图得到灰度图像的直方图,以确定图像是否暗、亮、低对比度等。C++ 获取C+中灰度图像的直方图+;在opencv中,c++,opencv,histogram,C++,Opencv,Histogram,我试图得到灰度图像的直方图,以确定图像是否暗、亮、低对比度等。 C++中有没有帮助做这件事? 这里解释得很好: 只需在加载灰度图像时跳过RGB部分。因此,不是: Mat src = imread( samples::findFile( parser.get<String>( "@input" ) ), IMREAD_COLOR ); if( src.empty() ) { return EXIT_FAILURE; }
C++中有没有帮助做这件事? 这里解释得很好: 只需在加载灰度图像时跳过RGB部分。因此,不是:
Mat src = imread( samples::findFile( parser.get<String>( "@input" ) ), IMREAD_COLOR );
if( src.empty() )
{
return EXIT_FAILURE;
}
vector<Mat> bgr_planes;
split( src, bgr_planes );
Mat src=imread(samples::findFile(parser.get(“@input”)),imread\u COLOR);
if(src.empty())
{
返回退出失败;
}
矢量bgr_平面;
拆分(src、bgr_平面);
我会:
Mat src = imread( samples::findFile( parser.get<String>( "@input" ) ), IMREAD_GRAYSCALE );
Mat src=imread(samples::findFile(parser.get(“@input”)),imread\u灰度);
而不是使用bgr\u平面的所有三个平面只使用src到目前为止您尝试了什么?我尝试了
calcHist()
函数,但它是用于RGB图像的“它是用于RGB图像的”。。。。from:“每个[input array]可以有任意数量的通道。”