Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

contour look strange

I try to convert contour into Pixel and the output look funny.

void extractContour(Mat input){
    Mat temp=Mat::zeros(input.rows,input.cols,CV_8U);
    vector<vector<Point>> contour;
    findContours(input,contour,RETR_EXTERNAL,CHAIN_APPROX_NONE);
    for(int i=0;i<contour[0].size();i++){
    temp.at<Vec3b>(contour[0][i])=255;
    cout<<contour[0][i]<<"\t";
    }
    cout<<endl;
    imwrite("/home/wxh/Desktop/Photo/1.bmp",temp);
}

image description

Any idea why is it deformed and in the wrong position?