Viewing sensor_msgs/Image while using rosbag API

asked 2015-03-26 12:23:05 -0500

kamek gravatar image

I'm using the rosbag API to sequentially process messages in a bag file. Some of these messages are images (of the type sensor_msgs/Image).

Is there an image viewing package that has an API that allows me to pass it an image of that type, and it will show the image? More specifically, I'm looking to do this:

// Specify topics to be read
std::vector<std::string> topics;
topics.push_back(imu_topic);
topics.push_back(camera_topic);
rosbag::View view(bag, rosbag::TopicQuery(topics));

// Loop through messages
BOOST_FOREACH(rosbag::MessageInstance const m, view)
{
  if (m.getTopic() == camera_topic)
  {
    sensor_msgs::Image::ConstPtr image = m.instantiate<sensor_msgs::Image>();
    if (image != NULL)
    {
      // CALL A FUNCTION TO VIEW IMAGE
    }
  }
}
edit retag flag offensive close merge delete