The use of April Tags as visual markers in localization, object identification, and as a target for camera calibration is supported in many applications. Even though they resemble QR codes, AprilTags encode fewer data. As a result, you can decode April tags more quickly, a crucial characteristic in many industries like real-time robots.

In this example, we'll use the readAprilTag function to locate and find AprilTags in calibration patterns. All common tag families are supported by this function.

The sample additionally utilizes Computer Vision ToolboxTM functionalities for end-to-end calibration. We swap out the checkerboard pattern for a grid of April tags that is uniformly spaced.

Using AprilTags as a calibration model has the following advantages:

  • better determining feature points
  • Consistency
  • Repeatable detections—typically, they are simple to see in real-time

Instead of the standard checkerboard patterns, you may apply the technique described below with other calibration patterns, such as a circular grid.

Step 1: Create a calibration pattern

Create and download your tag pictures. All supported families' pre-made tags are available for download from AprilRobotics via a web browser.

For a specific location of tags, you may create calibration targets using your tag picture using the helperGenerateAprilTagPattern method. To print your AprilTag pattern (from MATLAB), you may use calibPattern to get the pattern picture. The tag36h11 family is used in the example. The trade-off between false-positive detections and detection performance offered by these is worthwhile.

When the readAprilTag function is used for the pattern above, it detects instances when different tags' border locations belong to the same group. The layout above may be converted into a checkerboard-like column-major placement using the helperAprilTagToCheckerLocations method.

Step 2: Locate and AprilTag

To locate and recognize your April tags from the collected images, use the helperDetectAprilTagCorners method. Arrange the photographs in a checkerboard pattern to provide you the essential AprilTag points for the calibration procedure.

Step 3: Create World Coordinates for Your AprilTags

The AprilTag print that is produced resembles a checkerboard target. Using the generateCheckerboardPoints function, you may get the world coordinates for the coincident image corresponds you obtained from imagePoints.

The board size may be found in step two, and the tag size will replace the square size. Between the outer black sides of your tag, measure its length.

Step 4: Calculating the Camera Parameters

To approximate the parameters of your camera, use the estimateCameraParameters function. You may utilize the points lined up on your photograph and the global coordinate system.

Based on your observations, evaluate the accuracy of your calibration and extrinsic camera settings, which show the planes of your April tags in your acquired images.

Examine the locations of the reprojected points you obtained from approximating the camera's settings and the detected image points.

Supporting Activities

During the calibration procedure, AprilTag performs three primary supporting roles:

  • The helperGenerateAprilTagPattern method creates calibration models based on AprilTags.
  • Images with AprilTag calibration models may be found using the helperDetectAprilTagCorners method.
  • AprilTag corners are converted to checkerboard corners using the helperAprilTagToCheckerLocations method.

A Conclusion

The message in the example above may demonstrate how to calibrate cameras using AprilTag markers, but it is not explicitly related to AprilTags. The same technique may be applied with different calibration models in various applications.

To get the camera parameters you require, you must use the estimate camera parameters function:

WorldPoints: The critical calibration pattern points' congruent global coordinates

ImagePoints: Crucial locations in the coordinates of the pictures used to calibrate your calibration pattern.