class frc_apriltags.Detector(size: int = 6)

Bases: object

Use this class to detect AprilTags from the tag16h5 family.

Parameters:

size – The size of the AprilTag in inches.

detectTags(stream, camera_matrix, vizualization: int = 0)

Detects AprilTags in a stream using pupil_apriltags.

Parameters:
  • stream – The images generated by reading a VideoCapture.

  • camera_matrix – The camera’s intrinsic calibration matrix.

  • vizualization – 0 - Highlight, 1 - Highlight + Boxes, 2 - Highlight + Axes, 3 - Highlight + Boxes + Axes.

Returns:

The detection result.

Returns:

The image.

draw_pose_axes(img, camera_matrix, pose, center)

Draws the colored pose axes around the AprilTag.

Parameters:
  • img – The image to write on.

  • camera_matrix – The camera’s intrinsic calibration matrix.

  • pose – The Pose3d of the tag.

  • center – The center of the AprilTag.

draw_pose_box(img, camera_matrix, pose, z_sign=1)

Draws the 3d pose box around the AprilTag.

Parameters:
  • img – The image to write on.

  • camera_matrix – The camera’s intrinsic calibration matrix.

  • pose – The Pose3d of the tag.

  • z_sign – The direction of the z-axis.

enableLogging()

Enables logging for this class.

getPose3D(poseMatrix=None)

Calculates a WPILib Pose3d from the PupilApriltags matrix.

Parameters:

poseMatrix – A 3x4 numpy.ndarray().

Returns:

A Pose3d object.