synchronize kinect rgb/image_color depth/image or points
-------------------- SOLUTION ----------------- message_filters::TimeSynchronizer... has to be message_filters::Synchronizer... found that out after a day
How to mark as solved ?
Hi
I want to synchronize the image_color and the depth/image topic of a kinect.
both topics have different frequencies. i hoped before that they publish at the same time but sadly not.
is there a way to let these to topics been published simultaneously?
other posibility is to use a topic with rgb and d info, but i need an easy way to get the opencv rgb image.
the only topic i see, which has all info is "depth/points", but I need an opencv RGB image also, an iterative loop over the pointcloud to obtain the opencv image pixel by pixel seems to be studpi, because rgb image topic already exists.
why doesn'T that work:
private:
message_filters::Subscriber<sensor_msgs::image> image_sub;
message_filters::Subscriber<sensor_msgs::image> pointcloud_sub;
message_filters::TimeSynchronizer<sensor_msgs::image, sensor_msgs::image=""> synchronizer;
public :
// Constructor
VisualAidingOpenni()
: nh("~")/*, it(nh)*/, synchronizer(1), ....
private:
void a function ()... {
image_sub.subscribe(nh, topic_image, 1);
pointcloud_sub.subscribe(nh, topic_pointcloud, 1);
synchronizer.connectInput(image_sub, pointcloud_sub);
synchronizer.registerCallback(boost::bind(&VisualAidingOpenni::subscriber_Callback,this , _1, _2));
}
void subscriber_Callback(const sensor_msgs::ImageConstPtr& msg, const sensor_msgs::ImageConstPtr& pointcloud)
{
...
}
forget the word pointcloud, tried the depth image at last, so everything in sensor_msgs::image
this doesn't even compile
private:
message_filters::Subscriber<sensor_msgs::image> image_sub;
message_filters::Subscriber<sensor_msgs::image> pointcloud_sub;
typedef sync_policies::ApproximateTime<sensor_msgs::image, sensor_msgs::image=""> MySyncPolicy;
message_filters::TimeSynchronizer<mysyncpolicy> synchronizer;
void function()
{
image_sub = new message_filters::Subscriber(nh, topic_image, 1);
pointcloud_sub = new message_filters::Subscriber(nh, topic_pointcloud, 1);
synchronizer = new message_filters::TimeSynchronizer<mysyncpolicy>(MySyncPolicy(10), image_sub, pointcloud_sub);
synchronizer.registerCallback(boost::bind(&VisualAidingOpenni::subscriber_Callback,this , _1, _2));
}
void subscriber_Callback(const sensor_msgs::ImageConstPtr& msg, const sensor_msgs::ImageConstPtr& pointcloud)
{
i get this error
/opt/hector/students/friedrich/hector_visual_aiding/hector_visaid_monocular/src/visual_aiding_openni.cpp:-1: In Elementfunktion »void VisualAidingOpenni::CamInfo_Callback(const CameraInfoConstPtr&)«:
:-1: Fehler:[CMakeFiles/visual_aiding_openni.dir/src/visual_aiding_openni.o] Fehler 1
THX
Shouldn't "mysyncpolicy" be "MySyncPolicy"?
i have no idea why it isn't upper case here, but it is in qtcreator
Also could you post the error in a codeblock, it's getting mangled.
Yeah, there's no information on the error there.
well, the error message just tells me in which function i have the error, nothing more-
i installed 11.10 these days after i had ubuntu 12.04. since then my debugger information isn't as accurate as before, i don't know why. i use qtcreator. build type is debug.
The build type wouldn't affect compiler errors.
Can you try building it on the command line?