This class defines a set of markers whose locations are attached to a common reference system, i.e., they do not move wrt each other. A MarkerMap contains several markers so that they are more robustly detected. More...
#include <markermap.h>
Public Types | |
enum | Marker3DInfoType { NONE = -1, PIX = 0, METERS = 1 } |
Public Member Functions | |
std::pair< cv::Mat, cv::Mat > | calculateExtrinsics (const std::vector< aruco::Marker > &markers, float markerSize, cv::Mat CameraMatrix, cv::Mat Distorsion) |
MarkerMap | convertToMeters (float markerSize) const |
void | fromStream (std::istream &str) |
std::string | getDictionary () const |
void | getIdList (vector< int > &ids, bool append=true) const |
cv::Mat | getImage (float METER2PIX=0) const |
int | getIndexOfMarkerId (int id) const |
std::vector< int > | getIndices (const vector< Marker > &markers) const |
const Marker3DInfo & | getMarker3DInfo (int id) const |
bool | isExpressedInMeters () const |
bool | isExpressedInPixels () const |
MarkerMap () | |
MarkerMap (std::string filePath) | |
void | readFromFile (std::string sfile) |
void | saveToFile (std::string sfile) |
void | setDictionary (std::string d) |
void | toStream (std::ostream &str) |
Public Attributes | |
int | mInfoType |
Private Member Functions | |
void | readFromFile (cv::FileStorage &fs) |
void | saveToFile (cv::FileStorage &fs) |
Private Attributes | |
std::string | dictionary |
This class defines a set of markers whose locations are attached to a common reference system, i.e., they do not move wrt each other. A MarkerMap contains several markers so that they are more robustly detected.
A MarkerMap is only a list of the id of the markers along with the position of their corners. A MarkerMap may have information about the dictionary the markers belongs to
The position of the corners can be specified either in pixels (in a non-specific size) or in meters. The first is the typical case in which you generate the image of board and the print it. Since you do not know in advance the real size of the markers, their corners are specified in pixels, and then, the translation to meters can be made once you know the real size.
On the other hand, you may want to have the information of your boards in meters. The MarkerMap allows you to do so.
The point is in the mInfoType variable. It can be either PIX or METERS according to your needs.
Definition at line 111 of file markermap.h.
Enumerator | |
---|---|
NONE | |
PIX | |
METERS |
Definition at line 181 of file markermap.h.
aruco::MarkerMap::MarkerMap | ( | ) |
Definition at line 40 of file markermap.cpp.
aruco::MarkerMap::MarkerMap | ( | std::string | filePath | ) |
Loads from file
filePath | to the config file |
pair< cv::Mat, cv::Mat > aruco::MarkerMap::calculateExtrinsics | ( | const std::vector< aruco::Marker > & | markers, |
float | markerSize, | ||
cv::Mat | CameraMatrix, | ||
cv::Mat | Distorsion | ||
) |
Definition at line 433 of file markermap.cpp.
MarkerMap aruco::MarkerMap::convertToMeters | ( | float | markerSize | ) | const |
converts the passed board into meters
Definition at line 320 of file markermap.cpp.
void aruco::MarkerMap::fromStream | ( | std::istream & | str | ) |
Definition at line 424 of file markermap.cpp.
|
inline |
Definition at line 176 of file markermap.h.
void aruco::MarkerMap::getIdList | ( | std::vector< int > & | ids, |
bool | append = true |
||
) | const |
Set in the list passed the set of the ids
Definition at line 312 of file markermap.cpp.
cv::Mat aruco::MarkerMap::getImage | ( | float | METER2PIX = 0 | ) | const |
Returns an image of this to be printed. This object must be in pixels
Definition at line 340 of file markermap.cpp.
int aruco::MarkerMap::getIndexOfMarkerId | ( | int | id | ) | const |
Returns the index of the marker (in this object) with id indicated, if is in the vector
Definition at line 143 of file markermap.cpp.
std::vector< int > aruco::MarkerMap::getIndices | ( | const vector< Marker > & | markers | ) | const |
Definition at line 397 of file markermap.cpp.
const Marker3DInfo & aruco::MarkerMap::getMarker3DInfo | ( | int | id | ) | const |
Returns the Info of the marker with id specified. If not in the set, throws exception
Definition at line 153 of file markermap.cpp.
|
inline |
Indicates if the corners are expressed in meters
Definition at line 125 of file markermap.h.
|
inline |
Indicates if the corners are expressed in meters
Definition at line 131 of file markermap.h.
|
private |
Reads board info from a file
Definition at line 110 of file markermap.cpp.
void aruco::MarkerMap::readFromFile | ( | std::string | sfile | ) |
Reads board info from a file
|
private |
Saves the board info to a file
Definition at line 65 of file markermap.cpp.
void aruco::MarkerMap::saveToFile | ( | std::string | sfile | ) |
Saves the board info to a file
|
inline |
Definition at line 188 of file markermap.h.
void aruco::MarkerMap::toStream | ( | std::ostream & | str | ) |
Definition at line 414 of file markermap.cpp.
|
private |
Definition at line 199 of file markermap.h.
int aruco::MarkerMap::mInfoType |
Definition at line 195 of file markermap.h.