Reading videos and cameras
This section introduces you to video and camera reading using this simple example. Before explaining how to read videos or camera input, we want to introduce a new, very useful class that helps us to manage the input command-line parameters. This new class was introduced in OpenCV version 3.0, and is the CommandLineParser
class:
// OpenCV command line parser functions // Keys accepted by command line parser const char* keys = { "{help h usage ? | | print this message}" "{@video | | Video file, if not defined try to use webcamera}" };
The first thing that we have to do for CommandLineParser
is define what parameters we need or allow in a constant char
vector; each line has the following pattern:
"{name_param | default_value | description}"
name_param
can be preceded with @
, which defines this parameter as a default input. We can use more than one name_param
:
CommandLineParser parser(argc, argv, keys);
The constructor will get the inputs of the main function...