Base class for using MultiMarker. More...
#include <MultiMarker.h>
Public Member Functions | |
double | _GetPose (MarkerIterator &begin, MarkerIterator &end, Camera *cam, Pose &pose, IplImage *image) |
int | _SetTrackMarkers (MarkerDetectorImpl &marker_detector, Camera *cam, Pose &pose, IplImage *image) |
int | get_id_index (int id, bool add_if_missing=false) |
std::vector< int > | getIndices () |
int | getMasterId () |
template<class M > | |
double | GetPose (const std::vector< M > *markers, Camera *cam, Pose &pose, IplImage *image=0) |
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. | |
bool | IsValidMarker (int marker_id) |
Returns true if the marker is in the point cloud. | |
bool | Load (const char *fname, FILE_FORMAT format=FILE_FORMAT_DEFAULT) |
Loads multi marker configuration from a text file. | |
MultiMarker (std::vector< int > &indices) | |
Constructor. | |
MultiMarker () | |
Default constructor. | |
int | pointcloud_index (int marker_id, int marker_corner, bool add_if_missing=false) |
void | PointCloudAdd (int marker_id, double edge_length, Pose &pose) |
Adds marker corners to 3D point cloud of multi marker. | |
void | PointCloudCopy (const MultiMarker *m) |
Copies the 3D point cloud from other multi marker object. | |
void | PointCloudCorners3d (double edge_length, Pose &pose, CvPoint3D64f corners[4]) |
Calculates 3D coordinates of marker corners relative to given pose (camera). | |
void | PointCloudGet (int marker_id, int point, double &x, double &y, double &z) |
Returns 3D co-ordinates of one corner point of a marker. | |
bool | PointCloudIsEmpty () |
Returns true if the are not points in the 3D opint cloud. | |
void | PointCloudReset () |
Reserts the 3D point cloud of the markers. | |
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. | |
template<class M > | |
int | SetTrackMarkers (MarkerDetector< M > &marker_detector, Camera *cam, Pose &pose, IplImage *image=0) |
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. | |
size_t | Size () |
Return the number of markers added using PointCloudAdd. | |
template<class M > | |
double | Update (const std::vector< M > *markers, Camera *cam, Pose &pose, IplImage *image=0) |
Calls GetPose to obtain camera pose. | |
Public Attributes | |
std::vector< int > | marker_indices |
std::vector< int > | marker_status |
int | master_id |
std::map< int, CvPoint3D64f > | pointcloud |
std::vector< std::vector < btVector3 > > | rel_corners |
Private Member Functions | |
bool | LoadText (const char *fname) |
bool | LoadXML (const char *fname) |
bool | SaveText (const char *fname) |
bool | SaveXML (const char *fname) |
Base class for using MultiMarker.
Definition at line 45 of file MultiMarker.h.
alvar::MultiMarker::MultiMarker | ( | std::vector< int > & | indices | ) |
Constructor.
indices | Vector of marker codes that are included into multi marker. The first element defines origin. |
alvar::MultiMarker::MultiMarker | ( | ) | [inline] |
Default constructor.
Definition at line 96 of file MultiMarker.h.
double alvar::MultiMarker::_GetPose | ( | MarkerIterator & | begin, |
MarkerIterator & | end, | ||
Camera * | cam, | ||
Pose & | pose, | ||
IplImage * | image | ||
) |
Definition at line 296 of file MultiMarker.cpp.
int alvar::MultiMarker::_SetTrackMarkers | ( | MarkerDetectorImpl & | marker_detector, |
Camera * | cam, | ||
Pose & | pose, | ||
IplImage * | image | ||
) |
Definition at line 339 of file MultiMarker.cpp.
int alvar::MultiMarker::get_id_index | ( | int | id, |
bool | add_if_missing = false |
||
) |
Definition at line 38 of file MultiMarker.cpp.
std::vector<int> alvar::MultiMarker::getIndices | ( | ) | [inline] |
Definition at line 174 of file MultiMarker.h.
int alvar::MultiMarker::getMasterId | ( | ) | [inline] |
Definition at line 178 of file MultiMarker.h.
double alvar::MultiMarker::GetPose | ( | const std::vector< M > * | markers, |
Camera * | cam, | ||
Pose & | pose, | ||
IplImage * | image = 0 |
||
) | [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.
markers | Vector of markers seen by camera. |
cam | Camera object containing internal calibration etc. |
pose | The resulting pose is stored here. |
image | If != 0 some visualizations are drawn. |
Definition at line 107 of file MultiMarker.h.
bool alvar::MultiMarker::IsValidMarker | ( | int | marker_id | ) |
Returns true if the marker is in the point cloud.
marker_id | ID of the marker. |
Definition at line 290 of file MultiMarker.cpp.
bool alvar::MultiMarker::Load | ( | const char * | fname, |
FILE_FORMAT | format = FILE_FORMAT_DEFAULT |
||
) |
Loads multi marker configuration from a text file.
fname | file name |
format | FILE_FORMAT_TEXT (default) or FILE_FORMAT_XML (see doc/MultiMarker.xsd). |
Definition at line 205 of file MultiMarker.cpp.
bool alvar::MultiMarker::LoadText | ( | const char * | fname | ) | [private] |
Definition at line 168 of file MultiMarker.cpp.
bool alvar::MultiMarker::LoadXML | ( | const char * | fname | ) | [private] |
Definition at line 127 of file MultiMarker.cpp.
int alvar::MultiMarker::pointcloud_index | ( | int | marker_id, |
int | marker_corner, | ||
bool | add_if_missing = false |
||
) |
Definition at line 34 of file MultiMarker.cpp.
void alvar::MultiMarker::PointCloudAdd | ( | int | marker_id, |
double | edge_length, | ||
Pose & | pose | ||
) |
Adds marker corners to 3D point cloud of multi marker.
marker_id | Id of the marker to be added. |
edge_length | Edge length of the marker. |
pose | Current camera pose. |
Definition at line 264 of file MultiMarker.cpp.
void alvar::MultiMarker::PointCloudCopy | ( | const MultiMarker * | m | ) |
Copies the 3D point cloud from other multi marker object.
Definition at line 273 of file MultiMarker.cpp.
void alvar::MultiMarker::PointCloudCorners3d | ( | double | edge_length, |
Pose & | pose, | ||
CvPoint3D64f | corners[4] | ||
) |
Calculates 3D coordinates of marker corners relative to given pose (camera).
edge_length | The edge length of the marker. |
pose | Current pose of the camera. |
corners | Resulted 3D corner points are stored here. |
Definition at line 229 of file MultiMarker.cpp.
void alvar::MultiMarker::PointCloudGet | ( | int | marker_id, |
int | point, | ||
double & | x, | ||
double & | y, | ||
double & | z | ||
) |
Returns 3D co-ordinates of one corner point of a marker.
marker_id | ID of the marker which corner point is returned. |
point | Number of the corner point to return, from 0 to 3. |
x | x co-ordinate is returned. |
y | y co-ordinate is returned. |
z | z co-ordinate is returned. |
Definition at line 282 of file MultiMarker.cpp.
bool alvar::MultiMarker::PointCloudIsEmpty | ( | ) | [inline] |
Returns true if the are not points in the 3D opint cloud.
Definition at line 150 of file MultiMarker.h.
void alvar::MultiMarker::PointCloudReset | ( | ) |
Reserts the 3D point cloud of the markers.
Definition at line 225 of file MultiMarker.cpp.
void alvar::MultiMarker::Reset | ( | ) | [virtual] |
Resets the multi marker.
Definition at line 50 of file MultiMarker.cpp.
bool alvar::MultiMarker::Save | ( | const char * | fname, |
FILE_FORMAT | format = FILE_FORMAT_DEFAULT |
||
) |
Saves multi marker configuration to a text file.
fname | file name |
format | FILE_FORMAT_TEXT (default) or FILE_FORMAT_XML (see doc/MultiMarker.xsd). |
Definition at line 115 of file MultiMarker.cpp.
bool alvar::MultiMarker::SaveText | ( | const char * | fname | ) | [private] |
Definition at line 84 of file MultiMarker.cpp.
bool alvar::MultiMarker::SaveXML | ( | const char * | fname | ) | [private] |
Definition at line 56 of file MultiMarker.cpp.
int alvar::MultiMarker::SetTrackMarkers | ( | MarkerDetector< M > & | marker_detector, |
Camera * | cam, | ||
Pose & | pose, | ||
IplImage * | image = 0 |
||
) | [inline] |
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.
Definition at line 189 of file MultiMarker.h.
size_t alvar::MultiMarker::Size | ( | ) | [inline] |
Return the number of markers added using PointCloudAdd.
Definition at line 155 of file MultiMarker.h.
double alvar::MultiMarker::Update | ( | const std::vector< M > * | markers, |
Camera * | cam, | ||
Pose & | pose, | ||
IplImage * | image = 0 |
||
) | [inline] |
Calls GetPose to obtain camera pose.
Reimplemented in alvar::MultiMarkerFiltered.
Definition at line 118 of file MultiMarker.h.
Definition at line 62 of file MultiMarker.h.
Definition at line 63 of file MultiMarker.h.
Definition at line 72 of file MultiMarker.h.
std::map<int, CvPoint3D64f> alvar::MultiMarker::pointcloud |
Definition at line 61 of file MultiMarker.h.
std::vector< std::vector<btVector3> > alvar::MultiMarker::rel_corners |
Definition at line 64 of file MultiMarker.h.