Rosanswers logo


I have a webcam, and after calibrating with camera_calibration I created a program that when you click a part of the image will return pixel coordinates.

Assuming that the camera is on the ground, I want to calculate the point where intersect the ray (with projectPixelTo3dRay()) and the plane (the ground plane Z=0), relative to the robot coordinate frame. I have seen these codes but do not understand.

perceive_poo in void imageCb()

object_tracker in void imageCb()

Can anyone help me?


Originally posted by Alberto Martín on ROS Answers with karma: 17 on 2012-09-15

Post score: 1

Original comments

Comment by Alberto Martín on 2012-09-21:
Thanks dejanpan, It seems that this code uses the old version of image_geometry, projectPixelTo3dRay() return a ray or a point?

Comment by dejanpan on 2012-09-21:
It shall be a ray, that is a normalized vector. Of course you can also represent it as a point.


1 Answer 1


Rosanswers logo

They are using some basic transformation and trigonometric operations. In the end the ray gives you the direction and through the trigonometry you have to infer the right magnitude of the ray components. The final intersection with the ground (x, y point on the floor in robot's base frame) is saved in the variable poo:

poo.x = cameraOrigin.getX() + baseRay.getX() * s;

poo.y = cameraOrigin.getY() + baseRay.getY() * s;


Originally posted by dejanpan with karma: 1420 on 2012-09-20

This answer was ACCEPTED on the original site

Post score: 2


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.