callback needs access to multiple topics - how?
I'm trying to do some processing on images published by a kinect but this is a general camera-related question.
I would like to use the image_geometry functions contained in the PinholeCameraModel for converting 3d rays to pixels and 2d pixels to 3d rays, while making use of the calibration parameters published under /camera/rgb/camera_info.
The documentation gives an example like this:
image_geometry::PinholeCameraModel model_;
void imageCb(const sensor_msgs::ImageConstPtr& raw_image,
const sensor_msgs::CameraInfoConstPtr& cam_info)
{
// Update the camera model (usually a no-op)
model_.fromCameraInfo(cam_info);
// Do processing...
}
Defining a subscriber like this doesn't work though:
ros::Subscriber sub = n.subscribe("/camera/rgb/image_rect /camera/rgb/camera_info", 1, &imageCb);
I'm guessing that I have to do something to group the image with the camera_info into one single message, perhaps with image_transport(?), but I don't have any idea how to do this. I suppose i could create a separate callback for the camera info and update some global variable that the other callback could access but I think that's a less than ideal solution in general (in this case I'm sure it works, since the calibration parameters are constant).