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 | |
pair< cv::Mat, cv::Mat > | calculateExtrinsics (const std::vector< aruco::Marker > &markers, float markerSize, cv::Mat CameraMatrix, cv::Mat Distorsion) throw (cv::Exception) |
MarkerMap | convertToMeters (float markerSize) throw (cv::Exception) |
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 throw (cv::Exception) |
int | getIndexOfMarkerId (int id) const |
std::vector< int > | getIndices (vector< aruco::Marker > &markers) |
const Marker3DInfo & | getMarker3DInfo (int id) const throw (cv::Exception) |
bool | isExpressedInMeters () const |
bool | isExpressedInPixels () const |
MarkerMap () | |
MarkerMap (string filePath) throw (cv::Exception) | |
void | readFromFile (string sfile) throw (cv::Exception) |
void | saveToFile (string sfile) throw (cv::Exception) |
void | setDictionary (std::string d) |
void | toStream (std::ostream &str) |
Public Attributes | |
int | mInfoType |
Private Member Functions | |
void | readFromFile (cv::FileStorage &fs) throw (cv::Exception) |
void | saveToFile (cv::FileStorage &fs) throw (cv::Exception) |
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 71 of file markermap.h.
Enumerator | |
---|---|
NONE | |
PIX | |
METERS |
Definition at line 135 of file markermap.h.
aruco::MarkerMap::MarkerMap | ( | ) |
Definition at line 43 of file markermap.cpp.
aruco::MarkerMap::MarkerMap | ( | string | filePath | ) | |
throw | ( | cv::Exception | |||
) |
pair< cv::Mat, cv::Mat > aruco::MarkerMap::calculateExtrinsics | ( | const std::vector< aruco::Marker > & | markers, |
float | markerSize, | ||
cv::Mat | CameraMatrix, | ||
cv::Mat | Distorsion | ||
) | |||
throw | ( | cv::Exception | |
) |
Definition at line 389 of file markermap.cpp.
MarkerMap aruco::MarkerMap::convertToMeters | ( | float | markerSize | ) | |
throw | ( | cv::Exception | |||
) |
converts the passed board into meters
Definition at line 297 of file markermap.cpp.
void aruco::MarkerMap::fromStream | ( | std::istream & | str | ) |
Definition at line 384 of file markermap.cpp.
|
inline |
Definition at line 132 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 290 of file markermap.cpp.
cv::Mat aruco::MarkerMap::getImage | ( | float | METER2PIX = 0 | ) | const |
throw | ( | cv::Exception | |||
) |
Returns an image of this to be printed. This object must be in pixels
Definition at line 314 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 131 of file markermap.cpp.
std::vector< int > aruco::MarkerMap::getIndices | ( | vector< aruco::Marker > & | markers | ) |
Definition at line 364 of file markermap.cpp.
const Marker3DInfo & aruco::MarkerMap::getMarker3DInfo | ( | int | id | ) | const |
throw | ( | cv::Exception | |||
) |
Returns the Info of the marker with id specified. If not in the set, throws exception
Definition at line 141 of file markermap.cpp.
|
inline |
Indicates if the corners are expressed in meters
Definition at line 87 of file markermap.h.
|
inline |
Indicates if the corners are expressed in meters
Definition at line 90 of file markermap.h.
void aruco::MarkerMap::readFromFile | ( | string | sfile | ) | |
throw | ( | cv::Exception | |||
) |
Reads board info from a file
Definition at line 89 of file markermap.cpp.
|
private |
Reads board info from a file
Definition at line 101 of file markermap.cpp.
void aruco::MarkerMap::saveToFile | ( | string | sfile | ) | |
throw | ( | cv::Exception | |||
) |
Saves the board info to a file
Definition at line 58 of file markermap.cpp.
|
private |
Saves the board info to a file
Definition at line 65 of file markermap.cpp.
|
inline |
Definition at line 141 of file markermap.h.
void aruco::MarkerMap::toStream | ( | std::ostream & | str | ) |
Definition at line 378 of file markermap.cpp.
|
private |
Definition at line 148 of file markermap.h.
int aruco::MarkerMap::mInfoType |
Definition at line 145 of file markermap.h.