Ask Your Question

Revision history [back]

Yes there is a documentation. About findContours I think it is clear :

compresses horizontal, vertical, and diagonal segments and leaves only their end points. For example, an up-right rectangular contour is encoded with 4 points.

PS Are you sur of your link :Xingang, et al., "Bag of Contour Fragments for Robust Shape Classification" (2014). http://dl.acm.org/citation.cfm?id=258. 9350 is missing?

Yes there is a documentation. About findContours I think it is clear :

compresses horizontal, vertical, and diagonal segments and leaves only their end points. For example, an up-right rectangular contour is encoded with 4 points.

PS Are you sur of your link :Xingang, et al., "Bag of Contour Fragments can test using a small program :

    Mat img(300,300,CV_8UC1,Scalar::all(0)),imgColor;

    rectangle(img, Rect(100, 100, 100, 100), Scalar(255), -1);
    rectangle(img, Rect(150, 50, 100, 100), Scalar(255), -1);
    vector<vector<Point>> ctr;
    Mat hierarchy;
    findContours(img,ctr,hierarchy, RETR_LIST, CHAIN_APPROX_SIMPLE);
    cvtColor(img,imgColor,CV_GRAY2BGR);
    cout<< "#contour : "<<ctr.size()<<"\n";
    for Robust Shape Classification" (2014). http://dl.acm.org/citation.cfm?id=258.  9350 is missing?

(int i=0;i<ctr.size();i++) { cout<< "Ctr "<<i<<"\n"; for (int j=0;j<ctr[i].size();j++) { cout <<ctr[i][j]<<"\t"; putText(imgColor,format("%d",j), ctr[i][j], FONT_HERSHEY_SIMPLEX,1,Scalar(255,0,255)); } cout<<"\n"; } imshow("test", imgColor); waitKey();

result is :

image description