[OpenCV2.14.13]Can't open the second camera [closed]

asked 2016-11-21 04:02:39 -0600

Jack_Wellem gravatar image
  1. The work environment is : OpenCV 2.4.13, VS2008, Two different kind of usb camera.
  2. I can't open the sencond camera when using the following code

    int _tmain(int argc, _TCHAR* argv[]){
    VideoCapture capture(0);
    if( !capture.isOpened() )
        std::cout << "Capture0 can't be opened\n" << std::endl;
    
    VideoCapture capture1(1);
    if( !capture1.isOpened() )
        std::cout << "Capture1 can't be opened\n" << std::endl;
    
    return 0;}
    
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Jack_Wellem
close date 2016-11-22 04:09:35.678939

Comments

please spare us duplicate questions. (rather update your previous one)

berak gravatar imageberak ( 2016-11-21 04:13:20 -0600 )edit

same usb controller?

Micka gravatar imageMicka ( 2016-11-21 08:53:53 -0600 )edit

@Micka Thank you for your answer. Yes, i find that they use the same usb controller.

Jack_Wellem gravatar imageJack_Wellem ( 2016-11-21 19:21:29 -0600 )edit
1

Thank you, i have found that these camera use the same usb controller.If I want to open these cameras, i have to decrease the resolution. Below is the code that i can open the two camera:int _tmain(int argc, _TCHAR* argv[]) { VideoCapture camera0(1); camera0.set(CV_CAP_PROP_FRAME_WIDTH,432); camera0.set(CV_CAP_PROP_FRAME_HEIGHT,240); VideoCapture camera1(0); camera1.set(CV_CAP_PROP_FRAME_WIDTH,432); camera1.set(CV_CAP_PROP_FRAME_HEIGHT,240); return 0; }

Jack_Wellem gravatar imageJack_Wellem ( 2016-11-21 20:13:25 -0600 )edit