How can I mark (white/255) in Mat for contour points?
I want to mark (white/255) in Mat for contour points. I tried following way, but get error. How can I do this? Thanks in advance.
int main(..)
{
Mat image = imread("test0.png",CV_LOAD_IMAGE_GRAYSCALE);
vector<vector<cv::Point> > contours;
vector<Vec4i> hierarchy;
findContours (image, contours , hierarchy , cv :: RETR_EXTERNAL , cv :: CHAIN_APPROX_SIMPLE );
Mat contour_image = Mat::zeros( image.size(), CV_8UC1);
for(int k= 0; k < contours.size(); k++)
{
for(int l= 0; l < contours[k].size();l++)
{
int x1=contours[k][l].x;
int y1=contours[k][l].y;
contour_image.at<int>(y1,x1)=255;///error here
}
}
imshow("Contour_image", contour_image);
cv::waitKey(0);
}