Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The bitwise_and function is just what it says, a bitwise function. So since your src image is 3 channels, and the dst image is one channel, they don't match.

For this simple case, use src.copyTo(res, dst);

This uses the dst as a mask on the copy. Just make sure dst is all zeros first or there maybe junk data where the mask is empty.