# publishing calibration data with bag file

Hi,

I recorded a bag file with a video sequence. The corresponding bag file does only contain the image_raw topic, as by the time I recorded the sequence I had not calibrated the camera yet.

Now I have calibrated the camera, and I would like to play the bag file and simultaneously publish the camera_info data so that, for example, I can undistort the images from the bag file using image_proc.

How can I start a publisher that only publishes the camera_info ? Or could I add this camera_info in some way to the pre-existing bag file ?

Thanks

edit retag close merge delete

Sort by » oldest newest most voted

Hi BeLioN,

please take a look at our image_sequence_publisher where we publish images as a ros topic, while we read a yaml file and publish it as calibration for a "fake" camera.

You could take part of our code to make a node that publishes your calibration info in the correct topic.

more

There's always the option of manually running a publisher using the rostopic command line tool while replaying the bag file, but I think this will probably turn out to be too cumbersome.

Adding the CameraInfo messages to the bag file is probably a more convenient solution. You can add them to the existing bag quite easily by using the rosbag API. The examples in the rosbag Cookbook will probably help you find out how.

more