cv_bridge error in ROS2

asked 2020-09-22 13:17:55 -0500

Majed gravatar image

Hello fellow developers:

I am just a beginner in ROS2 and I have a wired error that I am not sure how to tackle. This Line:

msg = cv_bridge::CvImage(std_msgs::Header(), "bgr8", img).toImageMsg();

The error I get:

error: ‘Header’ is not a member of ‘std_msgs’

I have included the following:

#include "rclcpp/rclcpp.hpp"
#include <iostream>
#include <opencv2/opencv.hpp>
#include <cv_bridge/cv_bridge.h>
#include <sensor_msgs/image_encodings.hpp>

Please advise me in how to start debugging or solve the issue. #include <image_transport image_transport.h="">

edit retag flag offensive close merge delete



std_msgs::msg::Header is what you want - all messages are now in the msg sub-namespave.

KenYN gravatar image KenYN  ( 2020-09-22 21:56:33 -0500 )edit

Thank you that was the answer.

Majed gravatar image Majed  ( 2020-09-23 07:07:16 -0500 )edit