1 | initial version |
#include <iostream> // for standard I/O
#include <string> // for strings
#include <opencv2/core.hpp> // Basic OpenCV structures (cv::Mat)
#include <opencv2/highgui.hpp> // Video write
using namespace std;
using namespace cv;
int main(int argc, char *argv[])
{
const string source = argv[1]; // the source file name
VideoCapture inputVideo(source); // Open input
if (!inputVideo.isOpened())
{
cout << "Could not open the input video: " << source << endl;
return -1;
}
Mat src;
for(;;) //Show the image in the window and repeat
{
inputVideo >> src; // read
if (src.empty()) break; // check if at end
imshow( source,src );
if( (waitKey(29) & 255) == 27 ) break; // stop by pressing ESC
}
return 0;
}