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.