ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Calculate relative 3D position from points in stereo images?

asked 2017-09-28 09:46:53 -0500

Hendrik Wiese gravatar image

updated 2017-09-28 10:32:39 -0500

Hi everybody,

I have a (DIY) stereo camera readily calibrated so that it can be used with stereo_image_proc which successfully and beautifully creates a point cloud. That's nice so far... but it's not the question.

In addition to the image data (RGB) I also have several key points in image coordinates (x, y) that are generated from the pictures of both, the left and the right eye of the stereo camera. I would like to match these points so that I can calculate the Z-component for each point. That is, I have x1, y1, x2, y2 for each corresponding point and I'd like to have a full blown relative (and later on through tf absolute) x, y, z position for each point.

How would I go on about this? There's supposedly some equation that can make this calculation.

Thanks a lot!

//edit: oh, just to add to it: It is known which key point in the left corresponds to which one in the right image. That is, there is no feature matching necessary.

edit retag flag offensive close merge delete

Comments

I'm slightly confused: you mention you already have pointclouds, so that implies that dense-stereo matching / processing is already working and disparity can be (successfully?) calculated. Are you now asking to do the same thing again, but for some specific features in both images?

gvdhoorn gravatar image gvdhoorn  ( 2017-09-28 10:46:51 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-09-28 11:12:13 -0500

Ronald gravatar image

You've got all the information from the stereo calibration to construct an image_geometry::StereoCameraModel. You could use the projectDisparityTo3d function from the StereoCameraModel to get the 3D coordinates. Your input is a pixel location in rectified image (u, v) and the corresponding disparity (x2 - x1).

edit flag offensive delete link more

Comments

Works like a charm. Thanks a lot!

Hendrik Wiese gravatar image Hendrik Wiese  ( 2017-10-05 10:04:04 -0500 )edit
0

answered 2017-09-29 03:41:05 -0500

You`ll want to use OpenCV's triangulatepoints function, which is doing exactly what you're asking for (unless I misinterpreted your question :) ).

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-09-28 09:46:53 -0500

Seen: 931 times

Last updated: Sep 29 '17