Re: [ros-users] problem using TimeSynchronizer with two imag…

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: James Bowman
Date:  
To: ros-users
Subject: Re: [ros-users] problem using TimeSynchronizer with two images
TimeSynchronizer is doing fine, the problem is caused by CvBridge.

A CvBridge object is designed to handle one image at a time. So for this
case you should create two CvBridge objects, one for left and one for right.

So the code should be:

*sensor_msgs::CvBridge bridge[2];

void callback(const ImageConstPtr& left, const ImageConstPtr& right) {
     IplImage* im_left = bridge[0].imgMsgToCv(left, "rgb8");
     IplImage* im_right = bridge[1].imgMsgToCv(right, "rgb8");


     cvShowImage("left", im_left);
     cvShowImage("right", im_right);
}
*





On Thu, Mar 11, 2010 at 2:55 PM, Dan Lazewatsky
<>wrote:

> Hi all -
> I'm trying to use TimeSynchronizer to sync up images from two cameras, but
> I'm having some problems. In the following lines:
>    message_filters::Subscriber<Image> left_sub(nh, "stereo/left/image", 1);
>    message_filters::Subscriber<Image> right_sub(nh, "stereo/right/image",
> 1);

>
>    TimeSynchronizer<Image, Image> sync(left_sub, right_sub, 10);
>    sync.registerCallback(boost::bind(&callback, _1, _2));
> in the callback, both left and right appear to be the same image (they both
> seem to come from the rightmost subscriber given to sync). I've checked
> stereo/left/image and stereo/right/image with image_view and they are
> definitely different. Is there something I'm missing here? Code to reproduce
> is attached.

>
> On a related note, is there a way to use TimeSynchronizer with
> image_transport rather than subscribing to the image directly?
>
> Thanks,
> -Dan
>
> _______________________________________________
> ros-users mailing list
>
> https://code.ros.org/mailman/listinfo/ros-users
>
>



--
J.