Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

the code above will be :

  vector<Point> traceLine(Mat img , Point peak)
   {
vector<Point> vect1;
vector<Point> vect2;
img.at<uchar>(peak.y, peak.x)=0;//
vect1.push_back(peak);//add peak to vect1
while(vect1.size() != 0)
    {
    Point p=vect1[0];
    vect1.erase(vect1.begin());
    vect2.push_back(p);
    vector<Point> vectN;
    vectN = search8Neighbor(img, p);

    //cout<< " vectN.size()=" << vectN.size()<<endl;

    for(int i = 0; i < int(vectN.size()); ++i)
        {
            img.at<uchar>(vectN[i].y, vectN[i].x)=0;
            vect1.push_back(vectN[i]);
        }
    }
return vect2;
}