1 | initial version |
this is code from the outdated opencv1.0 c-api. YOU MUST NOT USE IT ! (and if you were using a more recent opencv version, it would not let you !)
opencv moved to c++ a long time ago, you'll have to follow up.
no idea, where you found that code, but please throw it away, and rather have a look at current opencv tutorials
using namespace cv;
using namespace std;
int main() { VideoCapture cap("path/to/my.avi"); if (! cap.isOpened()) { cout << "could not open the VideoCapture !" << endl; return -1; } while(true) { Mat frame; cap >> frame; if (frame.empty()) // movie is over { break; } imshow("ocv",frame); int k = waitKey(10); if (k==27) break; // esc. pressed } return 0; }
2 | No.2 Revision |
this is code from the outdated opencv1.0 c-api. YOU MUST NOT USE IT ! (and if you were using a more recent opencv version, it would not let you !)
opencv moved to c++ a long time ago, you'll have to follow up.
no idea, where you found that code, but please throw it away, and rather have a look at current opencv tutorials
#include "opencv2/opencv.hpp"
using namespace 3 | No.3 Revision |
this is code from the outdated opencv1.0 c-api. YOU MUST NOT USE IT !
(and if you were using a more recent opencv version, it would not let you !)
opencv moved to c++ a long time ago, you'll have to follow up.
no idea, where you found that code, but please throw it away, and rather have a look at current opencv tutorials
#include "opencv2/opencv.hpp"
using namespace cv;
#include <iostream>
using namespace std;
int main()
{
VideoCapture cap("path/to/my.avi");
if (! cap.isOpened())
{
cout << "could not open the VideoCapture !" << endl;
return -1;
}
while(true)
{
Mat frame;
cap >> frame;
if (frame.empty()) // movie is over
{
break;
}
imshow("ocv",frame);
int k = waitKey(10);
if (k==27) break; // esc. pressed
}
return 0;
}