我的相机可能有多个VideoCapture。不幸的是,有时与相机的连接似乎终止了。
示例:
Mat img;
VideoCapture v1(0);
v1.read(img); //img is a valid picture
VideoCapture v2(0);
v1.read(img); //img is a valid picture
v2.read(img); //img is a valid picture
v2 = v1;
v2.read(img); //img is not a valid picture. Connection seems to be closed
这是正确的行为,还是OpenCV中的错误?
有没有办法检查特定的devicenumber是否已经打开并获得负责的课程?
伪代码:
Mat img;
VideoCapture v1(0);
VideoCapture v2 = alreadyOpen(0);
alreadyOpen(0){
if(VideoCapture(0).isOpen()){ //how do i check that
return "v1" //how do i know where v1 is
}else{
return VideoCapture(0);
}
}
答案 0 :(得分:0)
见评论:
这是不可能的,如果OpenCV的行为是故意的,可能是一个错误/不清楚。