Program Listing for File dictionary_based.h

Return to documentation for file (include/aruco/dictionary_based.h)

#ifndef ArucoDictionaryBasedMarkerDetector_H
#define ArucoDictionaryBasedMarkerDetector_H

#include "dictionary.h"
#include "markerlabeler.h"

#include <opencv2/core/core.hpp>
namespace aruco
{
class DictionaryBased : public MarkerLabeler
{
public:
  virtual ~DictionaryBased()
  {
  }
  // first, dictionary, second the maximum correction rate [0,1]. If 0,no correction, if
  // 1, maximum allowed correction
  void setParams(const Dictionary& dic, float max_correction_rate);

  // main virtual class to o detection
  virtual bool detect(const cv::Mat& in, int& marker_id, int& nRotations,
                      std::string& additionalInfo);
  // returns the dictionary name
  virtual std::string getName() const;

  virtual int getNSubdivisions() const
  {
    return _nsubdivisions;
  }  //

  std::vector<Dictionary> getDictionaries() const
  {
    return vdic;
  }

private:
  // obfuscate start
  bool getInnerCode(const cv::Mat& thres_img, int total_nbits, std::vector<uint64_t>& ids);
  cv::Mat rotate(const cv::Mat& in);
  uint64_t touulong(const cv::Mat& code);
  std::vector<Dictionary> vdic;
  void toMat(uint64_t code, int nbits_sq, cv::Mat& out);
  int _nsubdivisions = 0;
  float _max_correction_rate;
  std::string dicttypename;
  std::map<uint32_t, std::vector<Dictionary*>> nbits_dict;
  // obfuscate end
};
}  // namespace aruco
#endif