AprilTagDetection

class robotpy_apriltag.AprilTagDetection

Bases: pybind11_object

A detection of an AprilTag tag.

class Point(*args, **kwargs)

Bases: pybind11_object

A point. Used for center and corner points.

Overloaded function.

  1. __init__(self: robotpy_apriltag._apriltag.AprilTagDetection.Point) -> None

  2. __init__(self: robotpy_apriltag._apriltag.AprilTagDetection.Point, x: float, y: float) -> None

property x
property y
getCenter() robotpy_apriltag._apriltag.AprilTagDetection.Point

Gets the center of the detection in image pixel coordinates.

Returns:

Center point

getCorner(ndx: int) robotpy_apriltag._apriltag.AprilTagDetection.Point

Gets a corner of the tag in image pixel coordinates. These always wrap counter-clock wise around the tag.

Parameters:

ndx – Corner index (range is 0-3, inclusive)

Returns:

Corner point

getCorners(cornersBuf: Tuple[float, float, float, float, float, float, float, float]) Tuple[float, float, float, float, float, float, float, float]

Gets the corners of the tag in image pixel coordinates. These always wrap counter-clock wise around the tag.

Parameters:

cornersBuf – Corner point array (X and Y for each corner in order)

Returns:

Corner point array (copy of cornersBuf span)

getDecisionMargin() float

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() str

Gets the decoded tag’s family name.

Returns:

Decoded family name

getHamming() int

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() Tuple[float, float, float, float, float, float, float, float, float]

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() numpy.ndarray[numpy.float64[3, 3]]

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

Gets the decoded ID of the tag.

Returns:

Decoded ID