Alpha channel for 8-bit PNG

asked 2014-02-11 17:35:07 -0600

ngryman gravatar image

updated 2018-01-04 07:29:40 -0600

Hi there,

I am trying to decode a 8-bit PNG with alpha channel using imdecode. Here is the chunk of code I use:

cv::Mat tmpMat(length, 1, CV_8UC1, buffer); // buffer is raw uint8_t data
cv::imdecode(tmpMat, CV_LOAD_IMAGE_UNCHANGED);

It seems that OpenCV does not recognize there is an alpha channel as the resulting matrix only has 3 channels. However this works fine for 24-bit PNG with alpha.

I'm using OpenCV from Ubuntu Saucy repository, here is the version I got:

$ pkg-config opencv --version
$ 0.26

Thanks!

edit retag flag offensive close merge delete