Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi! having two video input devices doesn't mean automatically that their IDs are 0 and 1, did you try to access the second camera alone with the ID 1 ? I have to cameras and here what I've tried and it worked :

int main (){

cv::VideoCapture cap(0), cap2(2);
int key = 0;
cv::Mat frame,frame1;

while(key != 27){
    cap2 >> frame1;
    cap >> frame;
    cv::imshow("0",frame);
    cv::imshow("1", frame1);
    key = cv::waitKey(10);

}
cap.release();
cap2.release();
return 0;
}

Hi! having two video input devices doesn't mean automatically that their IDs are 0 and 1, did you try to access the second camera alone with the ID 1 ? I have to two cameras and here what I've tried and it worked :

int main (){

cv::VideoCapture cap(0), cap2(2);
int key = 0;
cv::Mat frame,frame1;

while(key != 27){
    cap2 >> frame1;
    cap >> frame;
    cv::imshow("0",frame);
    cv::imshow("1", frame1);
    key = cv::waitKey(10);

}
cap.release();
cap2.release();
return 0;
}