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

get std_msgs::Header associated with a frame from image_transport?

asked 2015-09-23 09:13:38 -0500

drewm1980 gravatar image

Is there a way to get the std::msgs::Header associated with an image sent over image_transport? I need some unique key from my images to stick in the header of mesages derived from them to maintain the association.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-09-24 23:11:01 -0500

Willson Amalraj gravatar image

The images are passed as sensor_msgs::Image messages. You can definitely access the contents of the header in those messages. The header contains seq, stamp and frame_id. If for example you have a callback imageCb, then you can follow the code snippet to access the contents of the header.

   void imageCb(const sensor_msgs::ImageConstPtr& msg){  
          std::cout << msg->header.seq <<  std::endl;
          std::cout << msg->header.stamp <<  std::endl;
          std::cout << msg->header.frame_id <<  std::endl;

Is this what you want?

edit flag offensive delete link more


Yes, thanks!

drewm1980 gravatar image drewm1980  ( 2015-10-20 06:31:05 -0500 )edit

Question Tools

1 follower


Asked: 2015-09-23 09:13:38 -0500

Seen: 261 times

Last updated: Sep 24 '15