Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to make a composite mask?

I have several masks that I created using the compare() function. They are all CV_8U type. Now I want to make a composite mask in one step, if possible, using all of these submasks. I know how to make a logical OR'd mask using

final_mask = mask1 + mask2 + mask3...

but I want a logical AND'd mask. Doing this:

final_mask = mask1 * mask2 * mask3...

hangs up my application, likely because the result blows up too large for the saturate_cast<> operation. How do I do this? I see there's a bitwise_and() but I want pixelwise. Thanks.