title: How to subscribe to two topics in ROS in a good way (image and bounding boxes are published separately)
body: <p>I am currently building a ROS node for object detection. 
  It follows the following pipeline:</p>
  
  <ol>
  <li>The image is published</li>
  <li>The published image is subscribed by a neural network node, which runs an object detection on it and then publishes a list of bounding boxes.</li>
  <li>Now I would like to subscribe to both topics and perform a template matching on the detected bounding boxes. Then the result is published.</li>
  </ol>
  
  <p>The problem is that the image is published before the bounding box and I need to put them back together.</p>
  
  <p>My first idea would be something like <a href="https://answers.ros.org/question/12421/subscribing-2-topics-of-different-types-in-a-callback-function/" rel="nofollow noreferrer">this</a>, but the images are published much more often than the NN outputs the bounding box, so they don't fit together. Also, I have four cameras publishing on the same topic so I would need to also include the frame id.</p>
  
  <p>The second idea would be to publish one message with image and bounding box. This would probably be the cleanest version, but I am not sure how to do that with the image_transport method.</p>
  
  <p>I am using this implementation of darknet for ROS:
  <a href="https://github.com/leggedrobotics/darknet_ros" rel="nofollow noreferrer">https://github.com/leggedrobotics/darknet_ros</a></p>
  
  <p>Could somebody help me out, how to properly implement a safe and reliable way to publish the images with the bounding boxes in one message?</p>
  
  <p>Thanks!</p>