Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.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
opencv Mat<;乌查尔>;迭代器失败_Opencv - Fatal编程技术网

opencv Mat<;乌查尔>;迭代器失败

opencv Mat<;乌查尔>;迭代器失败,opencv,Opencv,opencv版本:3.4.1 void drawOnImage(const cv::Mat& binary, Mat& image) { Mat_<uchar>::const_iterator it = binary.begin<uchar>(); // THIS ONE Mat_<uchar>::const_iterator itend = binary.end<uchar>(); for (in

opencv版本:3.4.1

    void drawOnImage(const cv::Mat& binary, Mat& image) {
    Mat_<uchar>::const_iterator it = binary.begin<uchar>(); // THIS ONE
    Mat_<uchar>::const_iterator itend = binary.end<uchar>();

    for (int i = 0; it != itend; ++it, ++i) {
        if (!*it)
            circle(image, Point(i%image.step, i / image.step),
                5, Scalar(255, 0, 0));
    }
}

此函数的输出是binaray。

binary.channels()的值是多少?的值是3。为什么有3个通道的二进制图像?对不起,我的错误,值是1。我添加了关于binaray的代码。
    Mat getCorners(const Mat &image) {
    Mat result;

    dilate(image, result, cross);
    erode(result, result, diamond);
    Mat result2;

    dilate(image, result2, x);
    erode(result2, result2, square);
    absdiff(result2, result, result);

    applyThreshold(result);
    return result; // result == binaray
}