aruco_print_dictionary.cpp
Go to the documentation of this file.
1 //saves all the images of the dictionary indicated to a dicrectory
2 
3 #include "dictionary.h"
4 #include <opencv2/highgui/highgui.hpp>
5 #include <string>
6 using namespace std;
7 
8 int main(int argc,char **argv){
9 
10  if(argc<=3){
11  cerr << "Usage: dictionary outdir [bit_image_size: 75 default] " << endl;
12  auto dict_names=aruco::Dictionary::getDicTypes();
13  cerr<<"\t\tDictionaries: ";
14  for(auto dict:dict_names) cerr<<dict<<" ";cerr<<endl;
15  return -1;
16  }
18  int pixSize =75;
19  if (argc>=4) pixSize = std::stoi( argv[3]);
20 
21  string dict_name=aruco::Dictionary::getTypeString(dict.getType());
22  std::transform(dict_name.begin(), dict_name.end(), dict_name.begin(), ::tolower);
23  //
24  for(auto m:dict.getMapCode()) {
25  string number=std::to_string(m.second);
26  while(number.size()!=5) number="0"+number;
27  stringstream name;
28  name<<argv[2]<<"/"+dict_name+"_"<<number<<".png";
29  cout<<name.str()<<endl;
30  cv::imwrite(name.str(), dict.getMarkerImage_id(m.second, pixSize));
31 
32  }
33 }
cv::Mat getMarkerImage_id(int id, int bit_size, bool addWaterMark=true)
Dictionary::getMarkerImage_id.
Definition: dictionary.cpp:191
DICT_TYPES getType() const
Definition: dictionary.h:36
static std::vector< std::string > getDicTypes()
Definition: dictionary.cpp:270
int main(int argc, char **argv)
const std::map< uint64_t, uint16_t > & getMapCode() const
Definition: dictionary.h:45
static std::string getTypeString(DICT_TYPES t)
Definition: dictionary.cpp:235
static Dictionary loadPredefined(DICT_TYPES type)
Definition: dictionary.cpp:63


tuw_aruco
Author(s): Lukas Pfeifhofer
autogenerated on Mon Jun 10 2019 15:40:45