Ask Your Question
1

What's the difference between message_filters and image_transport?

asked 2013-10-02 23:04:08 -0600

ap gravatar image

Hi

I am using ROS Fuerte. I need to subscribe to 2 streams from the Kinect (color and depth) and use these to get 3D features. I understand to get the 2D feature I can use OpenCv and then relate this to the depth.

I have come across the link //wiki.ros.org/cv_bridge/Tutorials/UsingCvBridgeToConvertBetweenROSImagesAndOpenCVImages which has

16 image_transport::Subscriber image_sub_; 17 image_transport::Publisher image_pub_;

....

23 image_pub_ = it_.advertise("out", 1); 24 image_sub_ = it_.subscribe("in", 1, &ImageConverter::imageCb, this);

and the link

//wiki.ros.org/message_filters which has

19 message_filters::Subscriber<image> image1_sub(nh, "image1", 1); 20 message_filters::Subscriber<image> image2_sub(nh, "image2", 1);

Am I correct in saying in order to call both topics in one callback I have to synchronize the streams ?

using something like ApproximateTime Policy under 7.2 ?

Is it necessary to use both message_filters and image_transport ?

And if so how then do I declare the subscribers ?

What is the difference between message_filters and image_transport ?

Sorry for the confusion.

Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-06-28 11:50:16 -0600

Mark Rose gravatar image

message_filters and image_transport are two separate ROS packages. Each provides several _nodes_ which can be used in your configuration. In general, message_filters nodes are about filtering or coordinating message deliver, no matter the content of the messages, while image_transport nodes are concerned with manipulating the content of the messages.

To process the RGB and depth image together I've used two different strategies:

  1. Use a TimeSynchronizer message filter to coordinate the two different messages and call a single callback expecting both images. This is probably the best way. The downside is that there is a delay in TimeSynchronizer to pair up the most appropriate messages, which can delay processing of whichever image you want to make the highest priority.
  2. Have two callbacks, one for each message type. For one, say the depth callback, just save the frame away. In the RGB callback, process the RGB image with the most recent depth frame. The disadvantage here is that if the depth image usually precedes the associated RGB, but occasionally follows it, then you could process a stale depth image. The advantage, however, is that you process the RGB image as soon as it is received. (And you can process both when you receive the depth image instead, if you like.)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-10-02 23:04:08 -0600

Seen: 231 times

Last updated: Jun 28 '18