ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org
Ask Your Question
2

how to publish camera_info manually

asked 2016-06-14 14:58:24 -0500

Annaiyan gravatar image

I have a rosbag file which publishes the stereo images (left_image and right_image) but there is no camera_info attached to it.I want use the stereo_image_process packagelink text to get the point clouds.This node needs the image as well as camera_info to process the disparity and point cloud. I have calibrated file in.yaml file format but i don't know how to publish the information in it in a camera info topic for left and right images (camera)

Also,what is the best way to do the above issue with less computation?

Many thanks in advance

edit retag flag offensive close merge delete

Comments

Hi, There was a similar post in the ROS forums, check this link and this link . It might be of some help.

SpacemanSPIFF gravatar imageSpacemanSPIFF ( 2016-06-27 16:49:32 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-08-29 17:16:18 -0500

ckirksey gravatar image

Nice gist from @rossbar https://gist.github.com/rossbar/ebb28...

# Load data from file
with open(yaml_fname, "r") as file_handle:
    calib_data = yaml.load(file_handle)
# Parse
camera_info_msg = CameraInfo()
camera_info_msg.width = calib_data["image_width"]
camera_info_msg.height = calib_data["image_height"]
camera_info_msg.K = calib_data["camera_matrix"]["data"]
camera_info_msg.D = calib_data["distortion_coefficients"]["data"]
camera_info_msg.R = calib_data["rectification_matrix"]["data"]
camera_info_msg.P = calib_data["projection_matrix"]["data"]
camera_info_msg.distortion_model = calib_data["distortion_model"]
return camera_info_msg
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: 2016-06-14 14:58:24 -0500

Seen: 1,915 times

Last updated: Aug 29 '17