[英]OpenCV Error: Bad flag
I'm working in opencv on some methodes but keep getting the following error: 我正在某些方法上在opencv中工作,但始终收到以下错误:
OpenCV Error: Bad flag(parameter or structure field) (unrecognized or unsupported array)
Here is the code: 这是代码:
void RafiTextLineExtractor::eraseMargins(){
Mat img = _image.clone();
threshold(img, img, 100, 200, CV_THRESH_BINARY_INV);
BinaryComponentExtractor bn;
bn.setImage(&DImage(img));
vector<ConnectedComponent*> components;
bn.extract(components);
namedWindow("components",CV_WINDOW_NORMAL);
imshow("components", img);
}
void BinaryComponentExtractor::extract(vector<ConnectedComponent*>& components){
vector<vector<Point>> contours;
vector<Vec4i> hierarchy;
Mat mat = _image->getMat().clone();
cv::findContours(mat, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_NONE, Point(0, 0) );
collectComponents(contours, hierarchy, components);
}
void setImage(DImage* img) { _image = img; }
Also, when I debug the project it does not seem to pass the image (in bn.setImage()
..) any Ideas why that happens? 另外,当我调试项目时,它似乎没有传递图像(在bn.setImage()
..中),为什么会发生这种情况?
regards. 问候。
your function returns None. 您的函数返回None。 so you're trying to show None. 因此,您尝试显示“无”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.