(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Detection in a Single Image

Description: This tutorial teaches you how to use this package for tag and tag bundle detection in a single image.

Tutorial Level: BEGINNER

The single image detector detects tags and tag bundles in a single image. A typical use case is to check detections in a single frame of a video stream, which you maybe think is problematic.

Parameter Setup

The setup is of config/settings.yaml and config/tags.yaml is identical to the video stream detector.

launch/single_image_client.launch

Here you must set the camera intrinsics fx, fy, cx and cy (their meanings are given in the single image client interface description). You obtain these parameters typically from a camera intrinsics calibration (e.g. camera_calibration, which seems to work better for webcams, or Kalibr).

Run the Detector

The single image detector is based on a ROS service. You provide a file path to the image, the server runs it through the AprilTag detector (the same one as the video stream node) and provides you the detection results and saves an output image. The server publishes the results on the same topics as the video stream detector, however /tag_detections_image is not published (rather, it is saved as an output image). Begin by running the service's server node:

$ roslaunch apriltags2_ros single_image_server.launch

Now you can run the client in order to detect tags and tag bundles in your image:

$ roslaunch apriltags2_ros single_image_client.launch image_load_path:=<FULL PATH TO INPUT IMAGE> image_save_path:=<FULL PATH TO OUTPUT IMAGE>

PNG images work well (others may work too, but have not been tested). The client will run, you will see the server print out Done! if everything is successful, and the client will then quit (the server will continue running, waiting for another single image detection service call). The output image will be at your indicated output image path. If you have tag_debug: 1 in config/settings.yaml, then the intermediate AprilTag 2 algorithm's image processing images will be found in ~/.ros as *.pnm image files (where ~ is your home directory).

Wiki: apriltag_ros/Tutorials/Detection in a Single Image (last edited 2019-05-02 07:11:00 by rgreid)