SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
CVArucoParams Class Reference

ArUco Parameters loaded from configuration file. More...

#include <CVTrackedAruco.h>

Public Member Functions

 CVArucoParams ()
 
bool loadFromFile (string calibIniPath)
 

Public Attributes

cv::Ptr< cv::aruco::Dictionary > dictionary
 predefined dictionary More...
 
cv::Ptr< cv::aruco::DetectorParameters > arucoParams
 detector parameter structure for aruco detection function More...
 
float edgeLength
 marker edge length More...
 
int arucoDictionaryId
 id of aruco dictionary More...
 
string arucoDetectorParams
 todo: put in one file More...
 
string filename
 parameter filename More...
 

Detailed Description

ArUco Parameters loaded from configuration file.

Definition at line 29 of file CVTrackedAruco.h.

Constructor & Destructor Documentation

◆ CVArucoParams()

CVArucoParams::CVArucoParams ( )
inline

Definition at line 32 of file CVTrackedAruco.h.

32  : edgeLength(0.06f),
34  filename("aruco_detector_params.yml")
35  {
36 #if CV_MAJOR_VERSION < 4 || CV_MINOR_VERSION < 7
37  arucoParams = cv::aruco::DetectorParameters::create();
38 #else
39  arucoParams = cv::aruco::DetectorParameters();
40 #endif
41  }
int arucoDictionaryId
id of aruco dictionary
cv::Ptr< cv::aruco::DetectorParameters > arucoParams
detector parameter structure for aruco detection function
float edgeLength
marker edge length
string filename
parameter filename

Member Function Documentation

◆ loadFromFile()

bool CVArucoParams::loadFromFile ( string  calibIniPath)
inline

Definition at line 43 of file CVTrackedAruco.h.

44  {
45  string path = calibIniPath + filename;
46 
48  CVFileStorage fs(paramString, CVFileStorage::READ | CVFileStorage::MEMORY);
49  if (!fs.isOpened())
50  {
51  cout << "Could not find parameter file for ArUco tracking!" << endl;
52  cout << "Tried " << path << endl;
53  return false;
54  }
55 
56 #if CV_MAJOR_VERSION < 4 || CV_MINOR_VERSION < 7
57  fs["adaptiveThreshWinSizeMin"] >> arucoParams->adaptiveThreshWinSizeMin;
58  fs["adaptiveThreshWinSizeMax"] >> arucoParams->adaptiveThreshWinSizeMax;
59  fs["adaptiveThreshWinSizeStep"] >> arucoParams->adaptiveThreshWinSizeStep;
60  fs["adaptiveThreshConstant"] >> arucoParams->adaptiveThreshConstant;
61  fs["minMarkerPerimeterRate"] >> arucoParams->minMarkerPerimeterRate;
62  fs["maxMarkerPerimeterRate"] >> arucoParams->maxMarkerPerimeterRate;
63  fs["polygonalApproxAccuracyRate"] >> arucoParams->polygonalApproxAccuracyRate;
64  fs["minCornerDistanceRate"] >> arucoParams->minCornerDistanceRate;
65  fs["minDistanceToBorder"] >> arucoParams->minDistanceToBorder;
66  fs["cornerRefinementMethod"] >> arucoParams->cornerRefinementMethod; // cv::aruco::CornerRefineMethod
67  fs["cornerRefinementWinSize"] >> arucoParams->cornerRefinementWinSize;
68  fs["cornerRefinementMaxIterations"] >> arucoParams->cornerRefinementMaxIterations;
69  fs["cornerRefinementMinAccuracy"] >> arucoParams->cornerRefinementMinAccuracy;
70  fs["markerBorderBits"] >> arucoParams->markerBorderBits;
71  fs["perspectiveRemovePixelPerCell"] >> arucoParams->perspectiveRemovePixelPerCell;
72  fs["perspectiveRemoveIgnoredMarginPerCell"] >> arucoParams->perspectiveRemoveIgnoredMarginPerCell;
73  fs["maxErroneousBitsInBorderRate"] >> arucoParams->maxErroneousBitsInBorderRate;
74  fs["edgeLength"] >> edgeLength;
75  fs["arucoDictionaryId"] >> arucoDictionaryId;
76 #else
77  fs["adaptiveThreshWinSizeMin"] >> arucoParams.adaptiveThreshWinSizeMin;
78  fs["adaptiveThreshWinSizeMax"] >> arucoParams.adaptiveThreshWinSizeMax;
79  fs["adaptiveThreshWinSizeStep"] >> arucoParams.adaptiveThreshWinSizeStep;
80  fs["adaptiveThreshConstant"] >> arucoParams.adaptiveThreshConstant;
81  fs["minMarkerPerimeterRate"] >> arucoParams.minMarkerPerimeterRate;
82  fs["maxMarkerPerimeterRate"] >> arucoParams.maxMarkerPerimeterRate;
83  fs["polygonalApproxAccuracyRate"] >> arucoParams.polygonalApproxAccuracyRate;
84  fs["minCornerDistanceRate"] >> arucoParams.minCornerDistanceRate;
85  fs["minDistanceToBorder"] >> arucoParams.minDistanceToBorder;
86  fs["cornerRefinementMethod"] >> arucoParams.cornerRefinementMethod; // cv::aruco::CornerRefineMethod
87  fs["cornerRefinementWinSize"] >> arucoParams.cornerRefinementWinSize;
88  fs["cornerRefinementMaxIterations"] >> arucoParams.cornerRefinementMaxIterations;
89  fs["cornerRefinementMinAccuracy"] >> arucoParams.cornerRefinementMinAccuracy;
90  fs["markerBorderBits"] >> arucoParams.markerBorderBits;
91  fs["perspectiveRemovePixelPerCell"] >> arucoParams.perspectiveRemovePixelPerCell;
92  fs["perspectiveRemoveIgnoredMarginPerCell"] >> arucoParams.perspectiveRemoveIgnoredMarginPerCell;
93  fs["maxErroneousBitsInBorderRate"] >> arucoParams.maxErroneousBitsInBorderRate;
94  fs["edgeLength"] >> edgeLength;
95  fs["arucoDictionaryId"] >> arucoDictionaryId;
96 #endif
97 
98 #if CV_MAJOR_VERSION < 4 || CV_MINOR_VERSION < 7
99  dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::PREDEFINED_DICTIONARY_NAME(arucoDictionaryId));
100 #else
101  dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::PredefinedDictionaryType(arucoDictionaryId));
102 #endif
103 
104  return true;
105  }
cv::FileStorage CVFileStorage
Definition: CVTypedefs.h:61
string SLstring
Definition: SL.h:158
@ IOK_config
Definition: SLFileStorage.h:44
cv::Ptr< cv::aruco::Dictionary > dictionary
predefined dictionary
std::string readIntoString(std::string path, SLIOStreamKind kind)
Reads an entire file into a string.

Member Data Documentation

◆ arucoDetectorParams

string CVArucoParams::arucoDetectorParams

todo: put in one file

Definition at line 117 of file CVTrackedAruco.h.

◆ arucoDictionaryId

int CVArucoParams::arucoDictionaryId

id of aruco dictionary

Definition at line 116 of file CVTrackedAruco.h.

◆ arucoParams

cv::Ptr<cv::aruco::DetectorParameters> CVArucoParams::arucoParams

detector parameter structure for aruco detection function

Definition at line 109 of file CVTrackedAruco.h.

◆ dictionary

cv::Ptr<cv::aruco::Dictionary> CVArucoParams::dictionary

predefined dictionary

Definition at line 108 of file CVTrackedAruco.h.

◆ edgeLength

float CVArucoParams::edgeLength

marker edge length

Definition at line 115 of file CVTrackedAruco.h.

◆ filename

string CVArucoParams::filename

parameter filename

Definition at line 118 of file CVTrackedAruco.h.


The documentation for this class was generated from the following file: