Reputation: 4244
I have a binary Mat obtained by thresholding. I need to apply this binary Mat on a rgb Mat. Is there a method in opencv to apply a binary mask on a rgb image?
Upvotes: 0
Views: 4530
Reputation: 3532
Just use bitwise_and function:
Mat dest;
bitwise_and(rgbMat, binaryMat, dest);
it should work, but if not, just use cvtColor function to convert binaryMat
to BGR:
cvtColor(binaryMat, binaryMat, CV_GRAY2BGR); //but this before bitwise_and function
Upvotes: 3