fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include "opencv2/highgui/highgui.hpp"
  4. #include <iostream>
  5.  
  6. using namespace cv;
  7. using namespace std;
  8.  
  9. int main(int argc, char* argv[])
  10. {
  11. VideoCapture cap("C:/Users/Public/Videos/20151117214013.ts"); // open the video file for reading
  12.  
  13. if ( !cap.isOpened() ) // if not success, exit program
  14. {
  15. cout << "Cannot open the video file" << endl;
  16. return -1;
  17. }
  18.  
  19. //cap.set(CV_CAP_PROP_POS_MSEC, 300); //start the video at 300ms
  20.  
  21. double fps = cap.get(CV_CAP_PROP_FPS); //get the frames per seconds of the video
  22.  
  23. cout << "Frame per seconds : " << fps << endl;
  24.  
  25. namedWindow("MyVideo",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo"
  26.  
  27. while(1)
  28. {
  29. Mat frame;
  30.  
  31. bool bSuccess = cap.read(frame); // read a new frame from video
  32.  
  33. if (!bSuccess) //if not success, break loop
  34. {
  35. cout << "Cannot read the frame from video file" << endl;
  36. break;
  37. }
  38.  
  39. imshow("MyVideo", frame); //show the frame in "MyVideo" window
  40.  
  41. if(waitKey(30) == 27) //wait for 'esc' key press for 30 ms. If 'esc' key is pressed, break loop
  42. {
  43. cout << "esc key is pressed by user" << endl;
  44. break;
  45. }
  46. }
  47.  
  48. return 0;
  49.  
  50. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:39: fatal error: opencv2/highgui/highgui.hpp: No such file or directory
compilation terminated.
stdout
Standard output is empty