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

Revision history [back]

Okay, this is a fairly standard operation. In order to do this you'll need to know the dimensions of the pattern you're detecting and the calibration parameters of camera lens you are using. Using these two sets of information it is possible to determine the 6 DOF pose of the pattern with respect to the optical frame of the camera.

Firstly you'll need to calibrate your camera using the instructions described here, these calibration parameters allow you to determine the exact direction that each pixel of the camera image is facing.

Now you should be able to receive camera images and their camera info parameters, which allows you to do all sorts of clever things with OpenCV. You'll need to use two functions from the calibration and reconstruction module.

1) The findCirclesGrid function can be used to detect the location of the patterns circles in image space. If successful this returns the 2D locations of the centre of each circle in pixels.

2) Next the solvePnP function can be used with the circle points and the known size of the pattern to determine it's pose.

When defining the size of the pattern you assign each circle a 3D location in meters, the coordinate system used here defines the coordinate system of the pose that is produced.

Hope this gets you started.