关于turbojpeg.h中的解压函数tjDecompress2报错
-
用kinect sdk录制视频视频时候保存格式位jpeg 所以要解压成bgra格式但是在做图片解压时候报错 instance has not been initialized for decompression 不知道这个是什么意思
下面是网上找的解压函数 但是不对报错就报上面那个
bool MJPG2BGRA(const k4a::image&mjpgimage, k4a::image&bgraimage){
bgraimage = k4a::image::create(K4A_IMAGE_FORMAT_COLOR_BGRA32,
mjpgimage.get_width_pixels(), mjpgimage.get_height_pixels(), mjpgimage.get_width_pixels() * 4 * (int)sizeof(uint8_t)); tjhandle m_decompressor = tjInitCompress(); if (tjDecompress2(m_decompressor, mjpgimage.get_buffer(),//输入图片的数据数组取出 static_cast<unsigned long>(mjpgimage.get_size()), bgraimage.get_buffer(),//输入图片的数据存储在转换的图片上 mjpgimage.get_width_pixels(), 0, mjpgimage.get_height_pixels(), TJPF_BGRA, TJFLAG_FASTDCT | TJFLAG_FASTUPSAMPLE)!=0) { printf("解压失败"); } (void)tjDestroy(m_decompressor);
return ture;
}
-
求助啊啊啊啊啊 啊 啊
-
ddddingdingding