ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

For C++, you may consider the camera_calibration_parsers package from the ros_perception/image_common repository. It provides low-level methods for reading and writing between calibration files and CameraInfo messages.

For example, use the readCalibration function to load a calibration from file, after which you can publish it manually.

#include "camera_calibration_parsers/parse.hpp"
#include "sensor_msgs/msg/camera_info.hpp"

sensor_msgs::msg::CameraInfo camera_info;
std::string camera_name;
camera_calibration_parsers::readCalibration(
    "/path/to/calibration.yaml", camera_name, camera_info);

You can also look at the camera_info_manager and image_transport packages from the same repository which provide additional utility and abstraction on this topic.