linux 扫描网络摄像头,使用OpenCV从linux网络摄像头读取

我试图从连接到我的linux机器的网络摄像头读取原始视频。我使用OpenCV和l4v2库(gstreamer)。 这里是我的相机就一些细节问题:使用OpenCV从linux网络摄像头读取

[email protected]:~$ v4l2-ctl -d /dev/video0 --list-formats

ioctl: VIDIOC_ENUM_FMT

Index : 0

Type : Video Capture

Pixel Format: 'YUYV'

Name : YUV 4:2:2 (YUYV)

Index : 1

Type : Video Capture

Pixel Format: ''

Name : e436eb7d-524f-11ce-9f53-0020af0

Index : 2

Type : Video Capture

Pixel Format: 'RGB3' (emulated)

Name : RGB3

Index : 3

Type : Video Capture

Pixel Format: 'BGR3' (emulated)

Name : BGR3

Index : 4

Type : Video Capture

Pixel Format: 'YU12' (emulated)

Name : YU12

Index : 5

Type : Video Capture

Pixel Format: 'YV12' (emulated)

Name : YV12

这里是我的超级简单的代码:

VideoCapture capture = VideoCapture(0);

if (!capture.isOpened()) {

// Error in opening the video input

cerr << "Unable to open video file for read: " << FLAGS_in_video << endl;

}

else {

cout << "Opened video for read: " << FLAGS_in_video << endl;

}

,这里是输出和错误,我得到:

Trying to open device 0 to read.

VIDEOIO ERROR: V4L/V4L2: VIDIOC_S_CROP

mmap: Invalid argument

Opened video for read: 0

Unable to stop the stream.: Bad file descriptor

munmap: Invalid argument

munmap: Invalid argument

munmap: Invalid argument

munmap: Invalid argument

我已经建立带有WITH_V4L和WITH_LIBV4L标志的OpenCV标志为ON。

我很感激任何帮助或建议如何解决它。谢谢。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值