OpenCV: how to convert all pixels outside of mask to transparent?
07:01 05 Jan 2021

I have a 4 channels mask named maskMat colored in red (but I could choose any other color if required).

I have a 4 channels image named imageMat.

I want to set all the pixels of mat that are outside of maskMat to transparent color (in order to keep just the part of imageMat located in maskMat area).

How can I do that with OpenCV ? (I use openCV Java but an answer in any language will be ok)

Thanks.

android opencv contour