c++ - 如何将opencv图像(IplImage)写入V4L2环回设备?

标签 c++ c linux opencv v4l2

正如标题所说,我不确定如何将 IplImage 写入 V4l2 环回设备。正如我在此处发布的那样,我知道如何写入设备 How to write/pipe to a virtual webcam created by V4L2loopback module?

但现在我不确定如何将 IplImage 对象准确地写入设备。如果我只写 image->imageData,其中图像是 IplImage*,当我使用“luvcview”查看设备时,格式错误的帧会显示大约一秒钟,然后会抛出以下错误。

luvcview 0.2.6

SDL information:
  Video driver: x11
  A window manager is available
Device information:
 Device path:  /dev/video3
Stream settings:
  Frame format: YUYV (MJPG is not supported by device)
  Frame size:   520x474 (requested size 640x480 is not supported by device)
  Frame rate:   30 fps
libv4l2: error dequeuing buf: Invalid argument
Unable to dequeue buffer: Invalid argument
Error grabbing
Cleanup done. Exiting ...

会不会是我没有把opencv的图片转成v4l2格式?或者 v4l2 参数与 IplImage 属性不匹配?如果是怎么办?

如果有人知道这个错误是什么意思,请告诉我。

我决定单独发布这个问题,因为这个问题不是关于写入设备,而是特别是关于将 IplImage 写入设备。

谁能给我一个代码片段,说明如何将 IplImage 写入 V4l2 环回设备?

最佳答案

我发现上述问题不再是问题,因为 luvcview 或 skype 似乎不完全支持 v4l2。但是如果我使用 VLC 播放器查看环回设备,它工作正常。

关于c++ - 如何将opencv图像(IplImage)写入V4L2环回设备?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11270360/

相关文章:

c++ - 有没有可靠的方法在 double 中传递微秒时间?

c++ - cpp 2 的幂算法

c++ - 无法使用 SQL VDI(虚拟设备接口(interface))创建 strip 化备份

linux - 模拟非登录用户的权限

c++ - 用别名替换默认模板参数

c - sizeof(long long) 给出 8 但数字在 2**32 处溢出

c - 无法释放 C 中的 const 指针

C 非常基本的程序中的编译问题

linux - 用于应用程序的 Ubuntu 内核模块

linux - 如何测量我的算法消耗的功率?