Ask Your Question

Revision history [back]

The setTo functions will do what you want.

Mat img;
img.setTo(255, mask);

all elements which are non-zero in mask will change to 255 in img.

The setTo functions function will do what you want.

Mat img;
img.setTo(255, mask);

all elements which are non-zero in mask will change to 255 in img.