OpenCV bitwise_and + mask

Viewed 31612

I have this mask :

mask

Let's say I would like to make a bitwise_and with another image to fill in the white this works:

cv::bitwise_and(srcImage, mask, dstImage, [mask???]);

Now, the resulting image gives something like this :

Image + Mask

This is fine and dandy, but I'd like to subtract the black from the result. I've seen that bitwise_and also accepts an 8-bit single channel image, I'm not exactly sure what it does. I suppose if it's 0 then it let's it pass otherwise it ignores it.

So how would I use the same mask to convert it as an 8-bit image and use it to remove the black of the result? I'd like the same image, but without the black border essentially.

2 Answers
Related