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

Revision history [back]

I'm not sure that I entirely understand the question. If you want to convert a sensor_msgs::Image to a sensor_msgs::Ptr or sensor_msgs:ConsPtr, you only need to wrap it in a boost::shared_ptr:

sensor_msgs::Image::Ptr rosimg = boost::shared_ptr<sensor_msgs::Image>(image_msg);

Note that this is safe only if rosimg is heap-allocated. For example, you could initialize rosimg as:

sensor_msgs::Image::Ptr rosimg = boost::make_shared<sensor_msgs::Image>();