Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 获取C+中灰度图像的直方图+;在opencv中_C++_Opencv_Histogram - Fatal编程技术网

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]可以有任意数量的通道。”