SHARE
TWEET

Untitled

a guest Feb 9th, 2016 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <opencv2/opencv.hpp>
  3. #include <iostream>
  4. int main(int, char**) {
  5.     cv::VideoCapture vcap;
  6.     cv::Mat image;
  7.  
  8.     const std::string videoStreamAddress = "replacewithyourstreamaddress";
  9.        //open the video stream and make sure it's opened
  10.     if(!vcap.open(videoStreamAddress)) {
  11.         std::cout << "Error opening video stream or file" << std::endl;
  12.         return -1;
  13.     }
  14.  
  15.     while(1) {
  16.         if(!vcap.read(image)) {
  17.             std::cout << "No frame" << std::endl;
  18.             cv::waitKey();
  19.         }
  20.         cv::imshow("Output Window", image);
  21.  
  22.         if(cv::waitKey(1) >= 0) break;
  23.     }  
  24.  
  25. }
RAW Paste Data
Top