My Project
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
MultiMarkerInitializer Class Reference

Initializes multi marker by estimating their relative positions from one or more images. More...

#include <MultiMarkerInitializer.h>

Inheritance diagram for MultiMarkerInitializer:
MultiMarker

Classes

class  MarkerMeasurement
 MarkerMeasurement that holds the maker id. More...
 

Public Member Functions

 MultiMarkerInitializer (std::vector< int > &indices, int filter_buffer_min=4, int filter_buffer_max=15)
 
template<class M >
void MeasurementsAdd (const std::vector< M > *markers)
 
void MeasurementsReset ()
 
int Initialize (Camera *cam)
 
int getMeasurementCount ()
 
const std::vector< MarkerMeasurement > & getMeasurementMarkers (int measurement)
 
double getMeasurementPose (int measurement, Camera *cam, Pose &pose)
 
- Public Member Functions inherited from MultiMarker
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 Types

typedef std::vector< std::vector< MarkerMeasurement > >::iterator MeasurementIterator
 

Protected Member Functions

bool updateMarkerPoses (std::vector< MarkerMeasurement > &markers, const Pose &pose)
 
void MeasurementsAdd (MarkerIterator &begin, MarkerIterator &end)
 
- Protected Member Functions inherited from MultiMarker
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::vector< bool > marker_detected
 
std::vector< std::vector< MarkerMeasurement > > measurements
 
FilterMedianpointcloud_filtered
 
int filter_buffer_min
 
- Protected Attributes inherited from MultiMarker
std::map< int, cv::Point3d > pointcloud
 
std::vector< int > marker_indices
 
std::vector< int > marker_status
 

Detailed Description

Initializes multi marker by estimating their relative positions from one or more images.

To use, detect markers from images using MarkerDetector and call addMeasurement for each image that has at least two markers. Finally, call initialize to compute the relative positions of markers.

After the multi marker has been initialized, the point cloud can be copied into another MultiMarker implementation by PointCloudCopy.

Definition at line 49 of file MultiMarkerInitializer.h.

Member Function Documentation

◆ Initialize()

int Initialize ( Camera cam)

Tries to deduce marker poses from measurements.

Returns the number of initialized markers.

◆ MeasurementsAdd()

void MeasurementsAdd ( const std::vector< M > *  markers)
inline

Adds a new measurement for marker field initialization. Each measurement should contain at least two markers. It does not matter which markers are visible, especially the zero marker does not have to be visible in every measurement. It suffices that there exists a 'path' from the zero marker to every other marker in the marker field.

For example:

  • first measurement contains marker A and B.
  • second measurement containt markers ZERO and A.

When Initialize is called, the system can first deduce the pose of A and then the pose of B.

Definition at line 109 of file MultiMarkerInitializer.h.


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