V4L2_PIX_FMT_MJPEG获取到的数据怎么转成RGB格式啊

houge101 2018-05-18 03:05:53
我用V4L2在Linux上读出MJPEG格式的图像,我怎么转成RGB格式啊。或者换个话说。V4L2_PIX_FMT_MJPEG读出的数据是什么格式的,数据又是怎么组成的(比如,数据头的各个字节代表啥意思),转成RGB的流程是怎样的啊?
...全文
2400 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2018-07-28
  • 打赏
  • 举报
回复
引用 4 楼 mingji912 的回复:
[quote=引用 3 楼 houge101 的回复:] x谢谢两位,最终我调用了QT库去转换的
你好,我也碰到了同样的问题,请问你的解决办法可以分享下吗?[/quote] libyuv中有转换函数MJPEGToARGB
「已注销」 2018-07-24
  • 打赏
  • 举报
回复
引用 3 楼 houge101 的回复:
x谢谢两位,最终我调用了QT库去转换的
你好,我也碰到了同样的问题,请问你的解决办法可以分享下吗?
houge101 2018-05-29
  • 打赏
  • 举报
回复
x谢谢两位,最终我调用了QT库去转换的
fly 100% 2018-05-22
  • 打赏
  • 举报
回复
matlab 有标准函数可以直接调用
jklinux 2018-05-21
  • 打赏
  • 举报
回复
MJPEG格式就是读出的图像数据,保存起来就是jpg图像文件了. 想转成rgb需要把jpg解码成rgb才可以
获取USB摄像头的1080p的JPEG格式的图片20180608_1806.7z 电脑上的系统:ubuntu14.04 // http://www.linuxidc.com/Linux/2011-03/33020.htm // V4L2摄像头获取单幅图片测试程序(MMAP模式) // [日期:2011-03-06] 来源:Linux社区 作者:aokikyon [字体:大 中 小] // // #加了点注释 // // #Rockie Cheng // printf #include #include // memset #include #include #include #include // close write usleep read #include #include #include #include #include #include // mmap #include #include #include #include // pthread_create pthread_join #include #define CLEAR(x) memset (&(x), 0, sizeof (x)) #define REQ_COUNT 6 #define uchar unsigned char struct buffer { void * start; size_t length; }; static char * dev_name = "/dev/video0";//摄像头设备名 static int fd = -1; struct buffer * buffers = NULL; // static unsigned int n_buffers = 0; // 2012-7-13 11:33 camera flag // static int iFlagCamera = 0; volatile int iFlagCamera = 0; // 函数名称:thread1 // 函数功能:用于接受键盘的输入,之后通知thread2抓图 // 参数列表: // 返回值 : void thread1(void) { char ch; printf("\n !!!!Warning!!!!\n Max 1000 color bmp\n Input the char: \n"); printf("\n !!!!press o an capture 1 frame picture! \n"); printf("\n !!!!press t an capture 10 frame picture! \n"); printf("\n !!!!press h an capture 100 frame picture! \n"); while(1) { while((ch=getchar()) != '\n') { printf("%c\n", ch); if('o'==ch) { iFlagCamera = 1; printf("thread1=%d\n", iFlagCamera); } else if('t'==ch) { iFlagCamera = 10; printf("thread1=%d\n", iFlagCamera); } else if('h'==ch) { iFlagCamera = 101; printf("thread1=%d\n", iFlagCamera); } else if('q'==ch) { iFlagCamera = 10001; printf("thread1=%d\n", iFlagCamera

19,498

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧