0
$\begingroup$

Rosanswers logo

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.


Originally posted by drewm1980 on ROS Answers with karma: 258 on 2015-09-23

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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?


Originally posted by Willson Amalraj with karma: 206 on 2015-09-24

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by drewm1980 on 2015-10-20:
Yes, thanks!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.