Ask Your Question

Revision history [back]

JavaCV - Using cvCopy with semi-transparent mask


I'm trying to composite 2 images using a semi-transparent alpha mask. I'm currently using the cvCopy function to do the compositing as shown in the JavaCV watermark example.

However, it seems that semi-transparency is not taken into account when mixing the images. A grayscale value of 0 will take nothing from the second image, while any value >0 will take 100% of the second image.

If we take the images used in the watermark example above, the result I'm looking for would be a watermark with ~50% transparency (because the mask is grayish and not completely white). What function would I need to accomplish this type of blending?