Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Both mean and meanStdDev take a mask parameter.

If the transparency layer exists in the image you're reading in, just use extractChannel to pull it out. Make sure to threshold it at some value, since masks only work with 0 and 255. As @berak said, you can read in the images with the transparency in the fourth channel by using the IMREAD_ANY_COLOR or possibly the IMREAD_UNCHANGED flags.

If you just have the segmentation from other processing in OpenCV, it's not really transparency, just use it as a mask.