2014-11-08 21 views
0

我在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() ..)任何想法,爲什麼發生這種情況?

關於。

+0

噢是修好了,仍然出現錯誤。 – Nimrodshn 2014-11-08 13:10:47

回答

0

你的函數返回無。所以你試圖顯示無。

+0

問題不在於我沒有看到任何與它沒有正確傳遞墊子的功能。 – Nimrodshn 2014-11-08 13:16:50

+0

整體代碼plz,所以可以看到那個功能通過了。 – 2014-11-08 14:04:14