30 #include <opencv2/highgui/highgui.hpp> 37 class CmdLineParser{
int argc;
char **argv;
public:
CmdLineParser(
int _argc,
char **_argv):argc(_argc),argv(_argv){}
bool operator[] (
string param ) {
int idx=-1;
for (
int i=0; i<argc && idx==-1; i++ )
if (
string ( argv[i] ) ==param ) idx=i;
return ( idx!=-1 ) ; }
string operator()(
string param,
string defvalue=
"-1"){
int idx=-1;
for (
int i=0; i<argc && idx==-1; i++ )
if (
string ( argv[i] ) ==param ) idx=i;
if ( idx==-1 )
return defvalue;
else return ( argv[ idx+1] ); }};
40 int main(
int argc,
char **argv) {
44 cerr <<
"Usage: <makerid> outfile.(jpg|png|ppm|bmp) [options] \n\t[-bs <size>:bit size in pixels. 50 by default ] \n\t[-d <dictionary>: ARUCO default]" << endl;
46 cerr<<
"\t\tDictionaries: ";
47 for(
auto dict:dict_names) cerr<<dict<<
" ";cerr<<endl;
51 int pixSize = std::stoi( cml(
"-bs",
"75"));
57 }
catch (std::exception &ex) {
58 cout << ex.what() << endl;
cv::Mat getMarkerImage_id(int id, int bit_size, bool addWaterMark=true)
Dictionary::getMarkerImage_id.
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val)
static std::vector< std::string > getDicTypes()
static Dictionary loadPredefined(DICT_TYPES type)
int main(int argc, char **argv)