我在OpenCV中工作的一些methodes但不斷收到以下錯誤:OpenCV的錯誤:錯誤標誌
OpenCV Error: Bad flag(parameter or structure field) (unrecognized or unsupported array)
下面是代碼:
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; }
此外,當我調試項目它似乎沒有通過圖像(在bn.setImage()
..)任何想法,爲什麼發生這種情況?
關於。
噢是修好了,仍然出現錯誤。 – Nimrodshn 2014-11-08 13:10:47