Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It seems the image you provide is with alpha channel, where as you said the white region is complete transparent(alpha = 0), so just do the following.

  • Load source with alpha, you should set flags = -1 on imread().

  • Now split image in to four channel.

    Mat splitedBGRA[4];
    split(src,splitedBGRA);
    

Note that OpenCV channel order is BGRA.

See the result I got with the above algorithm.

image description