Ubuntu网络摄像头(Logitech C270)捕获上的Opencv错误-> HIGHGUI错误:V4L/V4L2:VIDIOC_S_CROP [英] Opencv Error on Ubuntu Webcam (Logitech C270) Capture -> HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP

查看:396
本文介绍了Ubuntu网络摄像头(Logitech C270)捕获上的Opencv错误-> HIGHGUI错误:V4L/V4L2:VIDIOC_S_CROP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此erorr消息出现在使用Logitech C270(OpenCV 2.4.2/C ++)在Ubuntu上运行简单的摄像机捕获时:

this erorr message appears on running simple camera capture on Ubuntu with logitech C270 (OpenCV 2.4.2/C++):

HIGHGUI错误:V4L/V4L2:VIDIOC_S_CROP

HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP

并进一步:

损坏的JPEG数据:标记0xd1之前2个无关的字节 损坏的JPEG数据:标记0xd6之前的1个无关字节 损坏的JPEG数据:标记0xd0之前的1个无关字节 损坏的JPEG数据:标记0xd0之前的1个无关字节

Corrupt JPEG data: 2 extraneous bytes before marker 0xd1 Corrupt JPEG data: 1 extraneous bytes before marker 0xd6 Corrupt JPEG data: 1 extraneous bytes before marker 0xd0 Corrupt JPEG data: 1 extraneous bytes before marker 0xd0

我得到帧,但是写入Mat对象时交换了帧的宽度和高度的值,如下所示:

I get frames but the values of frame width and height swapped when writing to a Mat object see below:

Mat frame;
videoCapture = new VideoCapture(camId);
if(!videoCapture->isOpened()) throw Exception();

cout << "Frame width: " << videoCapture->get(CV_CAP_PROP_FRAME_WIDTH) << endl;
cout << "Frame height: " << videoCapture->get(CV_CAP_PROP_FRAME_HEIGHT) << endl;

(*videoCapture) >> frame;

cout << "Mat width: " << frame.rows << endl;
cout << "Mat height: " << frame.cols << endl;

输出:

Frame width: 640
Frame height: 480
Mat width: 480
Mat height: 640

推荐答案

图像的宽度由其列数给出.您的代码应为

The width of an image is given by its number of columns. Your code should be

cout << "Mat width: " << frame.cols << endl;
cout << "Mat height: " << frame.rows << endl;

因此宽度和高度之间没有交换.

So there is no swap between width and height.

这篇关于Ubuntu网络摄像头(Logitech C270)捕获上的Opencv错误-&gt; HIGHGUI错误:V4L/V4L2:VIDIOC_S_CROP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆