Ask Your Question

Revision history [back]

Without knowing opencv version and platform and without anycode it is difficult to understand your problem.

using opencv 3.2-dev and VS 2015 windows 10 this code gives expecting result

    Mat img(10,10,CV_8UC1,Scalar::all(0));
    vector<vector<Point>> ctr;
    vector<cv::Vec4i> hierarchy;
    for (int i = 3; i <= 5; i++)
        for (int j = 3; j <= 5; j++)
            img.at<uchar>(i, j) = 1;
    findContours(img,ctr, hierarchy,CV_RETR_LIST, CV_CHAIN_APPROX_NONE);
    for (int i = 0; i < ctr.size(); i++)
    {
        cout<<"\n ctr : "<<i<<"\n";
        for (int j=0;j<ctr[i].size();j++)
            cout<<ctr[i][j]<<"\t";
    }

ctr : 0 [3, 3] [3, 4] [3, 5] [4, 5] [5, 5] [5, 4] [5, 3] [4, 3]