Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Something like this will get you two images and save them to two matrixes then you can always pass them to functions from inside the loop for processing.

  VideoCapture stream(1);
  if(!stream.isOpened()){
    cout << "Video stream unable to be opened exiting.." << endl;
    exit(0);
  } 

  Mat img1, img2;

  namedWindow("curImg", CV_WINDOW_AUTOSIZE);

  int w_width = 200;
  int w_height = 75;
  int counter=0;
  int delay = 100; // delay in milliseconds

while(true){
    cap >> img;
    Mat frame = Mat(w_height, w_width, CV_8UC3, Scalar(255,255,255));

    if(counter%2 ==0){
      frame.coppyTo(img1);
    }else{
      frame.copyTo(img2);
    }

    imshow("curImg", frame);
    waitKey(delay);
    counter++;
 }