Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

please do not abuse Mat::at to manipulate whole images, as it is slow and error-prone.

your image has 3 channels, thus you (would) have to use img.at<Vec3b> , not img.at<uchar>

but again, to set a whole image to white, rather use:

img.setTo(Scalar::all(255));

or even:

img = Scalar::all(255);

please do not abuse Mat::at to manipulate whole images, as it is slow and error-prone.

your image has 3 channels, thus you (would) have to use img.at<Vec3b> , not img.at<uchar>

but again, to set a whole image to white, rather use:

img.setTo(Scalar::all(255));
img.setTo(Scalar(255,255,255));

or even:

img = Scalar::all(255);