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

Getting RGB's pixel related coordinate in pointcloud (real world) with openni

asked 2013-11-21 08:39:16 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Someone knows how to discover the pointcloud "pixel"(x,y,z in real world) giving a pixel (v,u) from RGB camera?

I am using a feature descriptor (ORB) in RGB frame (/camera/rgb/image_color) its returns the u,v from the plannar image, I want a relation of this RGB pixel (feature) to get the real world coordinate in pointcloud topic (/camera/depth_registered/points).

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-01-16 07:04:08 -0600

barcelosandre gravatar image

Is that right if I search into pointcloud vector with this method?

I want the pointcloud index to rgb pixel h=240,w=320 (the center of rgb image).

void cloud_cb(const sensor_msgs::PointCloud2 cloud)
int pcl_index, rgb_h, rgb_w;
rgb_h = 240;
rgb_w = 320;
pcl_index = (h*480) + rgb_w; // result is 115520
pcl::PointCloud<pcl::pointxyz> point_pcl;
std::cout << "(x,y,z) = " << << std::endl;

will it return the point in the pointcloud for the center pixel of the rgb camera?

thank you,

edit flag offensive delete link more


I think it should be pcl_index = ( (rgb_w*cloud.height) + rgb_h);

McMurdo gravatar image McMurdo  ( 2014-03-13 23:30:06 -0600 )edit

Better method is to use at() member function.

McMurdo gravatar image McMurdo  ( 2014-03-14 02:11:58 -0600 )edit

Question Tools



Asked: 2013-11-21 08:39:16 -0600

Seen: 2,264 times

Last updated: Jan 16 '14