extrinsic_calibrator_core

ROS2 package designed to calibrate a set of cameras distributed throughout a room. The calibration is performed using ArUco markers scattered randomly in the environment. Each camera detects one or several ArUco markers within its field of view, and the algorithm reconstructs the positions of the markers to create a global map.

README

extrinsic_calibrator_core

Overview

extrinsic_calibrator_core is a ROS2 package designed to calibrate a set of cameras distributed throughout a room. The calibration is performed using ArUco markers scattered randomly in the environment. Each camera detects one or several ArUco markers within its field of view, and the algorithm reconstructs the positions of the markers to create a global map. The positions of the cameras are then computed and incorporated into this aforementioned map map.

The algorithm utilizes the OpenCV library to detect the markers and performs matrix transformations to compute the positions of both markers and cameras relative to each other.

Features

  • Extrinsically calibrate any number of cameras simultaneously.

  • Automatically build a global ArUco map using marker detection from multiple viewpoints.

  • Configurable ArUco marker properties and camera topics.

  • Includes an utility for generating printable ArUco markers.

Configuration

The package provides configuration options through YAML files.

ArUco Marker Parameters

You can customize the ArUco markers used in the calibration process by modifying the aruco_parameters.yaml file.

aruco_params:
  aruco_dict: # OpenCV marker dictionary
    type: string
    default_value: "DICT_6X6_250"
  marker_length: # Length of the marker side in meters
    type: double
    default_value: 0.26

Camera Topics Parameters

You can specify the topics for each camera in the camera_topics_parameters.yaml file. This setup is scalable to handle as many cameras as needed.

cameras_params:
  cam1:
    image_topic:
      type: string
      default_value: "/camera_1/image_raw"
    camera_info_topic:
      type: string
      default_value: "/camera_1/camera_info"
  cam2:
    image_topic:
      type: string
      default_value: "/camera_2/image_raw"
    camera_info_topic:
      type: string
      default_value: "/camera_2/camera_info"
  # cam3:
  #   image_topic:
  #     type: string
  #     default_value: "/camera_3/image_raw"
  #   camera_info_topic:
  #     type: string
  #     default_value: "/camera_3/camera_info"

Usage

  1. Place the ArUco marker with ID 0 where any camera can see it. This marker will serve as the reference point. The system will consider this marker’s position as the origin (0,0,0) of the global coordinate system, called map.

setup_paint
  1. Distribute the remaining ArUco markers around the room, ensuring they’re visible to different cameras.

For best results:

  • Try to have each camera see multiple markers.

  • Aim for overlap, where multiple cameras can see the same markers.

  • The more markers a camera can detect, and the more cameras that can see the same markers, the more accurate your calibration will be.

Remember, the system first builds a map of marker positions, then determines camera positions based on this map. So, having markers visible to multiple cameras helps create a more accurate and interconnected calibration.

cameras_paint

  1. Initiate the calibration process by running the extrinsic_calibrator_node.

calibration_cameras_paint
  1. Wait for the algorithm to gather the transform of each marker from each camera. The algorithm will iteratively tell the user which marker transforms are finally reliable and which ones are still being verified.

calibration_debug
  1. The calibrator will provide tables with useful information, while the calibration is taking place.

markers_per_cam marker_per_marker
  1. Finally, once the calibration is done, the frame of each marker and camera will be published in tf2.

tf_map

Launching the Calibrator

To run the extrinsic calibrator node, use the following command:

ros2 run extrinsic_calibrator_core extrinsic_calibrator_node.py

ArUco Marker Generator

This package also provides a utility to generate printable ArUco markers. To generate a set of markers, run:

ros2 run extrinsic_calibrator_core generator_aruco_node.py

Make sure to manually adjust the size of the printed ArUco markers before printing them. The length of the side of each ArUco marker has to match the marker_length parameter defined in aruco_parameters.yaml.

Dependencies

The package relies on the following libraries and ROS2 packages:

  • numpy for numerical operations

  • OpenCV for ArUco marker detection

  • PrettyTable to easily print the calibration status

  • tf2_ros for handling transformations

  • tf_transformations for matrix transformations

To install the necessary dependencies, ensure you run:

# update libraries
sudo apt-get update
# install ros dependencies
rosdep update
rosdep install --from-paths src --ignore-src -r -y

Author Information

Authors:

Created: October 2024

Affiliation: IKERLAN

setup_paint

Citation

If you use this code, please cite: Josep Rueda Collell. “ROS2 Extrinsic Camera Calibrator using ArUco Markers”. (2024).


Developed as part of AI-PRISM project.

AI Powered human-centred Robot Interactions for Smart Manufacturing

Horizon Europe – Grant Agreement number 101058589

Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union. The European Union cannot be held responsible for them. Neither the European Union nor the granting authority can be held responsible for them.

License

This software is provided under a dual license system. You may choose between:

  • GNU Affero General Public License v3: For open-source development, subject to the conditions of this license.

  • Commercial License: For proprietary use. For more details on the commercial license, please contact us at info@ikerlan.es.

Please see the LICENSE file for the complete terms and conditions of each license option.