Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Alpha channel for 8-bit PNG

Hi there,

I am trying to decode an 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!

Alpha channel for 8-bit PNG

Hi there,

I am trying to decode an 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!

Alpha channel for 8-bit PNG

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!