My Project
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MultiMarker Class Reference

Base class for using MultiMarker. More...

#include <MultiMarker.h>

Inheritance diagram for MultiMarker:
MultiMarkerBundle MultiMarkerEC MultiMarkerFiltered MultiMarkerInitializer

Public Member Functions

virtual void Reset ()
 Resets the multi marker.
 
bool Save (const char *fname, FILE_FORMAT format=FILE_FORMAT_DEFAULT)
 Saves multi marker configuration to a text file. More...
 
bool Load (const char *fname, FILE_FORMAT format=FILE_FORMAT_DEFAULT)
 Loads multi marker configuration from a text file. More...
 
 MultiMarker (std::vector< int > &indices)
 Constructor. More...
 
 MultiMarker ()
 Default constructor.
 
template<class M >
double GetPose (const std::vector< M > *markers, Camera *cam, Pose &pose, cv::Mat &image)
 Calculates the pose of the camera from multi marker. Method uses the true 3D coordinates of markers to get the initial pose and then optimizes it by minimizing the reprojection error. More...
 
template<class M >
double GetPose (const std::vector< M > *markers, Camera *cam, Pose &pose)
 
template<class M >
double Update (const std::vector< M > *markers, Camera *cam, Pose &pose, cv::Mat &image)
 Calls GetPose to obtain camera pose.
 
template<class M >
double Update (const std::vector< M > *markers, Camera *cam, Pose &pose)
 
void PointCloudReset ()
 Reserts the 3D point cloud of the markers.
 
void PointCloudCorners3d (double edge_length, Pose &pose, cv::Point3d corners[4])
 Calculates 3D coordinates of marker corners relative to given pose (camera). More...
 
void PointCloudAdd (int marker_id, double edge_length, Pose &pose)
 Adds marker corners to 3D point cloud of multi marker. More...
 
void PointCloudCopy (const MultiMarker *m)
 Copies the 3D point cloud from other multi marker object.
 
bool PointCloudIsEmpty ()
 Returns true if the are not points in the 3D opint cloud.
 
size_t Size ()
 Return the number of markers added using PointCloudAdd.
 
void PointCloudGet (int marker_id, int point, double &x, double &y, double &z)
 Returns 3D co-ordinates of one corner point of a marker. More...
 
bool IsValidMarker (int marker_id)
 Returns true if the marker is in the point cloud. More...
 
template<class M >
int SetTrackMarkers (MarkerDetector< M > &marker_detector, Camera *cam, Pose &pose, cv::Mat &image)
 Set new markers to be tracked for MarkerDetector Sometimes the MultiMarker implementation knows more about marker locations compared to MarkerDetector . Then this method can be used to reset the internal state of MarkerDetector for tracking also these markers.
 

Protected Member Functions

int pointcloud_index (int marker_id, int marker_corner, bool add_if_missing=false)
 
int get_id_index (int id, bool add_if_missing=false)
 
double _GetPose (MarkerIterator &begin, MarkerIterator &end, Camera *cam, Pose &pose, cv::Mat &image)
 
double _GetPose (MarkerIterator &begin, MarkerIterator &end, Camera *cam, Pose &pose)
 
int _SetTrackMarkers (MarkerDetectorImpl &marker_detector, Camera *cam, Pose &pose, cv::Mat &image)
 

Protected Attributes

std::map< int, cv::Point3d > pointcloud
 
std::vector< int > marker_indices
 
std::vector< int > marker_status
 

Detailed Description

Base class for using MultiMarker.

Definition at line 47 of file MultiMarker.h.

Constructor & Destructor Documentation

◆ MultiMarker()

MultiMarker ( std::vector< int > &  indices)

Constructor.

Parameters
indicesVector of marker codes that are included into multi marker. The first element defines origin.

Member Function Documentation

◆ GetPose()

double GetPose ( const std::vector< M > *  markers,
Camera cam,
Pose pose,
cv::Mat &  image 
)
inline

Calculates the pose of the camera from multi marker. Method uses the true 3D coordinates of markers to get the initial pose and then optimizes it by minimizing the reprojection error.

Parameters
markersVector of markers seen by camera.
camCamera object containing internal calibration etc.
poseThe resulting pose is stored here.
imageIf != 0 some visualizations are drawn.

Definition at line 118 of file MultiMarker.h.

◆ IsValidMarker()

bool IsValidMarker ( int  marker_id)

Returns true if the marker is in the point cloud.

Parameters
marker_idID of the marker.

◆ Load()

bool Load ( const char *  fname,
FILE_FORMAT  format = FILE_FORMAT_DEFAULT 
)

Loads multi marker configuration from a text file.

Parameters
fnamefile name
formatFILE_FORMAT_TEXT (default) or FILE_FORMAT_XML (see doc/MultiMarker.xsd).

◆ PointCloudAdd()

void PointCloudAdd ( int  marker_id,
double  edge_length,
Pose pose 
)

Adds marker corners to 3D point cloud of multi marker.

Parameters
marker_idId of the marker to be added.
edge_lengthEdge length of the marker.
poseCurrent camera pose.

◆ PointCloudCorners3d()

void PointCloudCorners3d ( double  edge_length,
Pose pose,
cv::Point3d  corners[4] 
)

Calculates 3D coordinates of marker corners relative to given pose (camera).

\param edge_length The edge length of the marker.
\param pose Current pose of the camera.
\param corners Resulted 3D corner points are stored here.

◆ PointCloudGet()

void PointCloudGet ( int  marker_id,
int  point,
double &  x,
double &  y,
double &  z 
)

Returns 3D co-ordinates of one corner point of a marker.

Parameters
marker_idID of the marker which corner point is returned.
pointNumber of the corner point to return, from 0 to 3.
xx co-ordinate is returned.
yy co-ordinate is returned.
zz co-ordinate is returned.

◆ Save()

bool Save ( const char *  fname,
FILE_FORMAT  format = FILE_FORMAT_DEFAULT 
)

Saves multi marker configuration to a text file.

Parameters
fnamefile name
formatFILE_FORMAT_TEXT (default) or FILE_FORMAT_XML (see doc/MultiMarker.xsd).

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