Ask Your Question
0

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

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

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
0

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

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;
pcl::fromROSMsg(cloud,point_pcl);
std::cout << "(x,y,z) = " << point_pcl.at(pcl_index) << 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

Comments

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

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

Better method is to use at() member function.

McMurdo gravatar image McMurdo  ( 2014-03-14 02:11:58 -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

3 followers

Stats

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

Seen: 1,915 times

Last updated: Jan 16 '14