D-Dᴙum
D-Dᴙum

Reputation: 7890

Convert 3-Channel (BGR) Matrix to 4-Channel (ABGR) Matrix

I'm using the Java libraries to work with OpenCV and I want to convert a 3 channel matrix in BGR format to 4 channels in ABGR. It has to be ABGR a because I am using a BufferedImage class to display the image and the alpha channel must come before the colours.

Within the Imgproc class there is a static method cvtColor() but it must take a code value to describe the conversion. In this case I want BGR to ABGR but there doesn't seem to be a conversion code for this, only with alpha after the colour channels COLOR_BGR2BGRA.

Is there any other way or helper class that will do the conversion that I require?

Upvotes: 2

Views: 519

Answers (1)

Andrey  Smorodov
Andrey Smorodov

Reputation: 10852

You can use split/merge methods to decompose/assemble image plains as you need.

Upvotes: 1

Related Questions