如何将 opencv 映像 (IplImage) 写入 V4L2 环回设备

How to write an opencv image (IplImage) to a V4L2 loopback device?

本文关键字:V4L2 写入 IplImage opencv 映像      更新时间:2023-10-16

正如标题所说,我不确定如何将 IplImage 写入 V4l2 环回设备。我知道如何写入设备,正如我在这里发布的那样 如何写入/管道到由 V4L2 环回模块创建的虚拟网络摄像头?

但是现在我不确定如何将IplImage对象准确地写入设备。如果我只编写图像>图像数据,其中图像是 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 播放器查看环回设备,它工作正常。