简体   繁体   English

OpenCV错误:错误标志

[英]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.

相关问题 opencv 3.0中的错误标志错误 - Bad Flag error in opencv 3.0 OpenCV 2.4.2“OpenCV错误:错误标志”出错 - Error in OpenCV 2.4.2 “OpenCV Error: Bad flag” 抛出&#39;cv :: Exception&#39;实例后,OpenCV中出现错误标志错误。 cvGetMat中不支持的数组类型 - Bad flag error in OpenCV after throwing an instance of 'cv::Exception' . Unsupported array type in cvGetMat OpenCV错误:cvGetMat中的错误标志(参数或结构字段)(无法识别或不支持的数组类型) - OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat 为什么OpenCV会为此代码发出“未知功能中的错误标志”? - Why does OpenCV emit “Bad flag in unknown function” for this code? OpenCV-TranCascade错误(bad_alloc) - OpenCV - TranCascade error (bad_alloc) OpenCV warpPerspective错误:通道数错误 - OpenCV warpPerspective error : Bad number of channels opencv错误中的(自适应)阈值处理(cvarrToMat中的错误参数(未知数组类型)) - (Adaptive) thresholding in opencv error (Bad argument (Unknown array type) in cvarrToMat) OpenCV错误:cvGetSize中的参数错误(数组应为CvMat或IplImage) - OpenCV Error: Bad argument (Array should be CvMat or IplImage) in cvGetSize OpenCV错误:BriefDescriptorExtractorImpl中的错误参数(字节必须为16,32或64) - OpenCV Error: Bad argument (bytes must be 16, 32, or 64) in BriefDescriptorExtractorImpl
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM