WPILibC++ 2024.3.2
frc::AprilTagDetection Class Referencefinal

A detection of an AprilTag tag. More...

#include <frc/apriltag/AprilTagDetection.h>

Classes

struct  Point
 A point. More...
 

Public Member Functions

 AprilTagDetection ()=delete
 
 AprilTagDetection (const AprilTagDetection &)=delete
 
AprilTagDetectionoperator= (const AprilTagDetection &)=delete
 
std::string_view GetFamily () const
 Gets the decoded tag's family name. More...
 
int GetId () const
 Gets the decoded ID of the tag. More...
 
int GetHamming () const
 Gets how many error bits were corrected. More...
 
float GetDecisionMargin () const
 Gets a measure of the quality of the binary decoding process: the average difference between the intensity of a data bit versus the decision threshold. More...
 
std::span< const double, 9 > GetHomography () const
 Gets the 3x3 homography matrix describing the projection from an "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1, -1)) to pixels in the image. More...
 
Eigen::Matrix3d GetHomographyMatrix () const
 Gets the 3x3 homography matrix describing the projection from an "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1, -1)) to pixels in the image. More...
 
const PointGetCenter () const
 Gets the center of the detection in image pixel coordinates. More...
 
const PointGetCorner (int ndx) const
 Gets a corner of the tag in image pixel coordinates. More...
 
std::span< double, 8 > GetCorners (std::span< double, 8 > cornersBuf) const
 Gets the corners of the tag in image pixel coordinates. More...
 

Detailed Description

A detection of an AprilTag tag.

Constructor & Destructor Documentation

◆ AprilTagDetection() [1/2]

frc::AprilTagDetection::AprilTagDetection ( )
delete

◆ AprilTagDetection() [2/2]

frc::AprilTagDetection::AprilTagDetection ( const AprilTagDetection )
delete

Member Function Documentation

◆ GetCenter()

const Point & frc::AprilTagDetection::GetCenter ( ) const
inline

Gets the center of the detection in image pixel coordinates.

Returns
Center point

◆ GetCorner()

const Point & frc::AprilTagDetection::GetCorner ( int  ndx) const
inline

Gets a corner of the tag in image pixel coordinates.

These always wrap counter-clock wise around the tag. Index 0 is the bottom left corner.

Parameters
ndxCorner index (range is 0-3, inclusive)
Returns
Corner point

◆ GetCorners()

std::span< double, 8 > frc::AprilTagDetection::GetCorners ( std::span< double, 8 >  cornersBuf) const
inline

Gets the corners of the tag in image pixel coordinates.

These always wrap counter-clock wise around the tag. The first set of corner coordinates are the coordinates for the bottom left corner.

Parameters
cornersBufCorner point array (X and Y for each corner in order)
Returns
Corner point array (copy of cornersBuf span)

◆ GetDecisionMargin()

float frc::AprilTagDetection::GetDecisionMargin ( ) const
inline

Gets a measure of the quality of the binary decoding process: the average difference between the intensity of a data bit versus the decision threshold.

Higher numbers roughly indicate better decodes. This is a reasonable measure of detection accuracy only for very small tags– not effective for larger tags (where we could have sampled anywhere within a bit cell and still gotten a good detection.)

Returns
Decision margin

◆ GetFamily()

std::string_view frc::AprilTagDetection::GetFamily ( ) const

Gets the decoded tag's family name.

Returns
Decoded family name

◆ GetHamming()

int frc::AprilTagDetection::GetHamming ( ) const
inline

Gets how many error bits were corrected.

Note: accepting large numbers of corrected errors leads to greatly increased false positive rates. NOTE: As of this implementation, the detector cannot detect tags with a hamming distance greater than 2.

Returns
Hamming distance (number of corrected error bits)

◆ GetHomography()

std::span< const double, 9 > frc::AprilTagDetection::GetHomography ( ) const

Gets the 3x3 homography matrix describing the projection from an "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1, -1)) to pixels in the image.

Returns
Homography matrix data

◆ GetHomographyMatrix()

Eigen::Matrix3d frc::AprilTagDetection::GetHomographyMatrix ( ) const

Gets the 3x3 homography matrix describing the projection from an "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1, -1)) to pixels in the image.

Returns
Homography matrix

◆ GetId()

int frc::AprilTagDetection::GetId ( ) const
inline

Gets the decoded ID of the tag.

Returns
Decoded ID

◆ operator=()

AprilTagDetection & frc::AprilTagDetection::operator= ( const AprilTagDetection )
delete

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