35 #include <opencv2/highgui/highgui.hpp>    36 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] ); }};
    43         if (argc < 4 || cml[
"-h"]) {
    44             cerr << 
"Usage: X:Y Image.png Configuration.yml [-d dictionary_name (ARUCO_MIP_36h12 default)] [-s <pixSize>] [-t <Type>(0: panel,1: chessboard )] [-r rand_seed] [-i interMarkerDistance(0,1)]" << endl;
    49         if (sscanf(argv[1], 
"%d:%d", &XSize, &YSize) != 2) {
    50             cerr << 
"Incorrect X:Y specification" << endl;
    55         int pixSize = stoi(cml(
"-s",
"500"));
    56         int typeMarkerMap = stoi(cml(
"-t",
"0"));
    57         int rand_seed = stoi(cml(
"-r",
"0"));
    58         float interMarkerDistance = stof(cml(
"-i",
"0.2"));
    60         if ((interMarkerDistance > 1.
f) || (interMarkerDistance < 0.
f)) {
    61             cerr << 
"Incorrect interMarkerDistance '" << interMarkerDistance << 
"' -- needs to be [0,1]" << endl;
    67         for(
auto d:Dict.getMapCode()) ids.push_back(
d.second);
    70         std::random_shuffle(ids.begin(),ids.end());
    72         ids.resize(XSize*YSize);
    73         aruco::MarkerMap BInfo=Dict.createMarkerMap(Size(XSize, YSize), pixSize, pixSize * interMarkerDistance,ids,typeMarkerMap==1);
    75         cv::Mat MarkerMapImage=BInfo.
getImage();
    79        imwrite(argv[2], MarkerMapImage);
    81     } 
catch (std::exception &ex) {
    82         cout << ex.what() << endl;
 
void saveToFile(string sfile)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val)
static std::vector< std::string > getDicTypes()
CmdLineParser(int _argc, char **_argv)
string operator()(string param, string defvalue="-1")
bool operator[](string param)
int main(int argc, char **argv)
static Dictionary loadPredefined(DICT_TYPES type)
cv::Mat getImage(float METER2PIX=0) const 
This class defines a set of markers whose locations are attached to a common reference system...