1 | initial version |
you should probably stop trying with any outdated opencv1.0 c - based ideas, but use opencv2 style c++:
#include "opencv2/opencv.hpp"
using namespace cv;
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
Mat frame;
VideoCapture cap;
if (argc>1) cap.open(argv[1]);
else cap.open(0);
while(cap.isOpened() && cap.read(frame))
{
//
// process frame as you wish..
//
imshow("ocv",frame);
if (waitKey(10)==27) break;
}
}
2 | No.2 Revision |
you should probably stop trying with any outdated opencv1.0 c - based ideas, but use opencv2 style c++:
#include "opencv2/opencv.hpp"
using namespace cv;
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
Mat frame;
VideoCapture cap;
if (argc>1) cap.open(argv[1]);
else cap.open(0);
while(cap.isOpened() && cap.read(frame))
{
//
// process frame as you wish..
//
imshow("ocv",frame);
if (waitKey(10)==27) break;
}
}
3 | No.3 Revision |
you should probably stop trying with any outdated opencv1.0 c - based ideas, but use opencv2 style c++:
#include "opencv2/opencv.hpp"
using namespace cv;
int main(int argc, char **argv)
{
Mat frame;
VideoCapture cap;
if (argc>1) cap.open(argv[1]);
cap.open(argv[1]); // some vid passed as cmdline arg
else cap.open(0);
cap.open(0); // by default use webcam
while(cap.isOpened() && cap.read(frame))
{
//
// process frame as you wish..
//
imshow("ocv",frame);
if (waitKey(10)==27) break;
}
}