1) 我在使用 OpenCV(更新的 Kubuntu Linux)处理两台罗技 c310 相机时遇到此错误
VIDIOC_STREAMON:设备上没有剩余空间
整个错误日志如下
**IDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument**
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
**libv4l2: error turning on stream: No space left on device**
**VIDIOC_STREAMON: No space left on device**
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /home/rjdp/Computer_Vision/0_Installers/OpenCV-2.4.2/modules/core/src/array.cpp, line 2482
terminate called after throwing an instance of 'cv::Exception'
what(): /home/rjdp/Computer_Vision/0_Installers/OpenCV-2.4.2/modules/core/src/array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat
2) 它仅在处理两个摄像头时发生,即使在默认的低分辨率 640x480 下也是如此。我仍然尝试将代码中的分辨率降低到 320x240,但这也不起作用。
3) 我在这里和其他网站上搜索了很多其他帖子。这告诉我没有足够的可用 USB 摄像头带宽。所以我试着在前面的 USB 上插入一个摄像头,在背面插入一个摄像头,但也失败了:(
我的问题是:
Is it possible to solve this issue of bandwith/memory & run two or more cameras together on opencv 2.4.2 ?? OpenCV uses ffmpeg to handle I/O so can i tell my camera hardware with some ffmpeg command to take input stream with compressed MPEG mode instead of bandwidth consuming normal mode.
代码如下:
#include "opencv2/opencv.hpp"
#include <stdio.h>
using namespace cv;
int main(int, char**)
{
VideoCapture cap01(0); // open the default camera
cap01.set(CV_CAP_PROP_FRAME_WIDTH,320);
cap01.set(CV_CAP_PROP_FRAME_HEIGHT,240);
//sleep(1);
if(!cap01.isOpened()) // check if we succeeded
return -1;
namedWindow("Camera01",1);
VideoCapture cap02(1); // open the default camera
cap02.set(CV_CAP_PROP_FRAME_WIDTH,320);
cap02.set(CV_CAP_PROP_FRAME_HEIGHT,240);
if(!cap02.isOpened()) // check if we succeeded
return -1;
namedWindow("Camera02",1);
for(;;)
{
Mat frame, frame_1;
//Mat frame02;
cap02 >> frame;
imshow("Camera01", frame);
if(waitKey(30) >= 0) break;
Mat frame_1;
cap02 >> frame_1;
imshow("Camera02", frame_1);
if(waitKey(30) >= 0) break;
}
return 0;
}
最佳答案
使用 PCI USB 扩展卡为我解决了同样的问题,因为网络摄像头占用了 USB 总线上的所有可用带宽。使用 pci usb 扩展卡为您提供第二个 usb 总线,您可以连接第二个网络摄像头
关于c++ - OpenCV 多相机处理问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13216373/