Ask Your Question

Revision history [back]

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];

Note that OpenCV channel order is BGRA.

See the result I got with the above algorithm.

image description