added test to save image with webp with alpha channel

This commit is contained in:
andrey.morozov
2013-06-29 21:59:25 +04:00
parent 4f19216e45
commit 8d0452ed59
2 changed files with 31 additions and 2 deletions

View File

@@ -143,7 +143,15 @@ bool WebPDecoder::readData(Mat &img)
uchar* out_data = img.data;
unsigned int out_data_size = m_width * m_height * 3 * sizeof(uchar);
uchar *res_ptr = WebPDecodeBGRInto(data.data, data.total(), out_data, out_data_size, m_width * 3);
uchar *res_ptr = 0;
if (channels == 3)
{
res_ptr = WebPDecodeBGRInto(data.data, data.total(), out_data, out_data_size, img.step);
}
else if (channels == 4)
{
res_ptr = WebPDecodeBGRAInto(data.data, data.total(), out_data, out_data_size, img.step);
}
if(res_ptr == out_data)
{