1 | initial version |
To answer your first question, to get the pixel value (its colour), then you should use the following:
For a grayscale image, you would use this
Scalar colour = drawing.at<uchar>(Point(x, y));
if(colour.val[0]==255)
For a 3-channel colour image, you would use this
Vec3b colour = drawing.at<Vec3b>(Point(x, y));
if(colour.val[0]==255 && colour.val[1]==255 && colour.val[2]==255)
To answer your second question, like Vladislav said, it would be "uchar" if it is a grayscale and "Vec3b" if it is a colour image, see below for example:
For grayscale you would use it like this,
image.at<uchar>(Point(x,y)) = 255;
For a 3-channel colour image it would be,
image.at<Vec3b>(Point(x, y))[0] = 255;
image.at<Vec3b>(Point(x, y))[1] = 255;
image.at<Vec3b>(Point(x, y))[2] = 255;