c++ - Appying a binary threshold filter on a rgb image opencv -


i have binary mat obtained thresholding. need apply binary mat on rgb mat. there method in opencv apply binary mask on rgb image?

just use bitwise_and function:

mat dest; bitwise_and(rgbmat, binarymat, dest); 

it should work, if not, use cvtcolor function convert binarymat bgr:

cvtcolor(binarymat, binarymat, cv_gray2bgr); //but before bitwise_and function 

Comments