Class Marker

Inheritance Relationships

Base Type

  • public std::vector< cv::Point2f >

Class Documentation

class Marker : public std::vector<cv::Point2f>

Public Functions

Marker()
Marker(int id)
Marker(const Marker &M)
Marker(const std::vector<cv::Point2f> &corners, int _id = -1)
inline ~Marker()
inline bool isValid() const

Indicates if this object is valid

inline bool isPoseValid() const
void draw(cv::Mat &in, cv::Scalar color = cv::Scalar(0, 0, 255), int lineWidth = -1, bool writeId = true, bool writeInfo = false) const

Draws this marker in the input image

void calculateExtrinsics(float markerSize, const CameraParameters &CP, bool setYPerpendicular = true)

Calculates the extrinsics (Rvec and Tvec) of the marker with respect to the camera

Parameters:
  • markerSize – size of the marker side expressed in meters

  • CP – parmeters of the camera

  • setYPerpendicular – If set the Y axis will be perpendicular to the surface. Otherwise, it will be the Z axis

void calculateExtrinsics(float markerSize, cv::Mat CameraMatrix, cv::Mat Distorsion = cv::Mat(), cv::Mat Extrinsics = cv::Mat(), bool setYPerpendicular = true, bool correctFisheye = false)

Calculates the extrinsics (Rvec and Tvec) of the marker with respect to the camera

Parameters:
  • markerSize – size of the marker side expressed in meters

  • CameraMatrix – matrix with camera parameters (fx, fy, cx, cy)

  • Distortion – matrix with distortion parameters (k1, k2, p1, p2)

  • setYPerpendicular – If set the Y axis will be perpendicular to the surface. Otherwise, it will be the Z axis

  • correctFisheye – Correct fisheye distortion

void glGetModelViewMatrix(double modelview_matrix[16])

Given the extrinsic camera parameters returns the GL_MODELVIEW matrix for opengl. Setting this matrix, the reference coordinate system will be set in this marker

void OgreGetPoseParameters(double position[3], double orientation[4])

Returns position vector and orientation quaternion for an Ogre scene node or entity. Use: … Ogre::Vector3 ogrePos (position[0], position[1], position[2]); Ogre::Quaternion ogreOrient (orientation[0], orientation[1], orientation[2], orientation[3]); mySceneNode->setPosition( ogrePos ); mySceneNode->setOrientation( ogreOrient ); …

cv::Point2f getCenter() const

Returns the centroid of the marker

float getPerimeter() const

Returns the perimeter of the marker

float getArea() const

Returns the area

float getRadius() const

Returns radius of enclosing circle

inline bool operator==(const Marker &m) const

compares ids

void copyTo(Marker &m) const
Marker &operator=(const Marker &m)

compares ids

void toStream(std::ostream &str) const
void fromStream(std::istream &str)
inline vector<cv::Point3f> get3DPoints() const
cv::Mat getTransformMatrix() const

Public Members

int id
float ssize
cv::Mat Rvec
cv::Mat Tvec
std::string dict_info
vector<cv::Point> contourPoints

Public Static Functions

static vector<cv::Point3f> get3DPoints(float msize)

Friends

inline friend bool operator<(const Marker &M1, const Marker &M2)
inline friend std::ostream &operator<<(std::ostream &str, const Marker &M)