opencv Mat<;乌查尔>;迭代器失败
opencv版本:3.4.1opencv 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
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
}