如何将MJPEG解码为原始RGB(或YUV)数据

问题描述 投票:-3回答:1

我正在使用Video4Linux2打开与连接到本机的摄像机的连接。我可以从相机设备请求YUV或MJPEG数据。由于提高相机的请求分辨率(同时还请求YUV)会导致程序减慢相机的刷新率(大概是因为在该时间内发送的数据太多),因此我需要使用以下格式的MJPEG数据:相机。我已经被卡住了一段时间了,并且在网上几乎找不到关于如何解码MJPEG的资源。

顺便说一下,我拥有以下所有数据:

unsigned char *data; // pointing to the data for the most current mjpeg frame from v4l2
size_t data_size; // the size (in bytes) of the mjpeg frame received from v4l2

unsigned char *r, *g, *b; // three heap allocated arrays in which to store the resulting data
// Can easily be altered to represent an array of structs holding all 3 components,
// as well as using yuv at different rates.

我需要的就是能够将我的mjpeg帧实时into]原始数据转换为RGB或YUV的功能。我听说过像libjpeg,mjpegtools,nvjpeg等库,但是关于如何使用它们从我所在的位置解码mjpeg的信息,我还找不到很多。任何帮助将不胜感激!

我正在使用Video4Linux2打开与连接到本机的摄像机的连接。我可以从相机设备请求YUV或MJPEG数据。由于增加了所请求的...

c++ c jpeg mjpeg v4l2
1个回答
0
投票

我通过评论中链接的消息源知道了。我的工作示例如下:

© www.soinside.com 2019 - 2024. All rights reserved.