0
$\begingroup$

Rosanswers logo

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).


Originally posted by barcelosandre on ROS Answers with karma: 168 on 2013-11-21

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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::PointCloudpcl::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,


Originally posted by barcelosandre with karma: 168 on 2014-01-16

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by McMurdo on 2014-03-13:
I think it should be pcl_index = ( (rgb_w*cloud.height) + rgb_h);

Comment by McMurdo on 2014-03-14:
Better method is to use at() member function.

$\endgroup$

Your Answer

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