Reading videos and cameras

This section introduces you to reading a video and camera with this simple example:

#include <iostream> #include <string> #include <sstream> using namespace std; // OpenCV includes #include "opencv2/core.hpp" #include "opencv2/highgui.hpp" using namespace cv; // OpenCV command line parser functions // Keys accecpted by command line parser const char* keys = { "{help h usage ? | | print this message}" "{@video | | Video file, if not defined try to use webcamera}" }; int main( int argc, const char** argv ) { CommandLineParser parser(argc, argv, keys); parser.about("Chapter 2. v1.0.0"); //If requires help show if (parser.has("help")) { parser.printMessage(); return 0; } String videoFile= parser.get<String>(0); // Check if ...

Get OpenCV By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.