Ask Your Question
0

converting DisparityImage message to PointCloud2

asked 2018-03-23 11:53:11 -0500

2ROS0 gravatar image

Hi,

I want to convert a DisparityImage message to a PointCloud2 messages such that each pixel disparity value is now a x, y, z value of a point in space. The other information that comes as part of the DisparityImage message are the focal length, max disparity and baseline. I know how to calculate the z value using them but I'm not sure what the equation is for x and y?

I was looking at this opencv function reprojectImageTo3D() but that needs the Q perspective transformation matrix. How should I calculate that?

Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-03-23 12:41:34 -0500

Thomas D gravatar image

Take a look at the stereo_image_proc/point_cloud2 nodelet. That should do what you want.

edit flag offensive delete link more

Comments

Yeah but I would rather just construct the Q matrix myself and make the opencv call. I guess what I'm asking is, does the DisparityImage message have enough information to make the Q matrix? I found the equations here but don't have required fields...

2ROS0 gravatar image 2ROS0  ( 2018-03-23 12:44:10 -0500 )edit

Probably not... The page you linked says "Combines a rectified color image and disparity image to produce a point cloud" so maybe the image_rect has the remainder of the information, that's a bummer. I would've thought the disparity message should come with all required values.

2ROS0 gravatar image 2ROS0  ( 2018-03-23 12:51:18 -0500 )edit

Most of the remaining information should come from the camera_info topics.

Thomas D gravatar image Thomas D  ( 2018-03-23 13:05:28 -0500 )edit

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: 2018-03-23 11:53:11 -0500

Seen: 162 times

Last updated: Mar 23 '18