Ask Your Question

multiple webcam test [closed]

asked 2013-11-22 13:42:43 -0500

xiongtec gravatar image

updated 2013-11-22 15:07:10 -0500

So I have a usb logitech webcam and a built in laptop webcam. I am trying to start both the webcam at same time. I made a demo code below to test but cap2 object keep failing to open. Do any you guys have a suggestion. cap is the default which is the logitech webcam and cap2 is the built in web cap.

#include <iostream>
#include <opencv2\highgui\highgui.hpp>
#include <string>

int main(int arg, char * args[])
    cv::VideoCapture cap, cap2;
    cv::Mat mat1;
    cv::Mat mat2;;;
        return -1;
        return -2;

    cv::namedWindow("MyVideo",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo"
    cv::namedWindow("MyVideo2",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo2"


        cv::imshow("MyVideo2", mat2);
    return 0;
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by StevenPuttemans
close date 2013-11-22 15:15:15.552358


And actually this is a duplicate of ... please stick to a single question! You can update the question itself using edit button.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-22 15:14:33 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-11-22 15:09:53 -0500

Actually I know that in windows it is not possible to create a single thread application that opens multiple webcams. You should try creating two seperate threads and open a camera in each thread for processing. Making two applications that grab from seperate cameras simultaneously is possible however I am not sure if this influences your data capture rate.

edit flag offensive delete link more

Question Tools


Asked: 2013-11-22 13:42:43 -0500

Seen: 227 times

Last updated: Nov 22 '13