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

Revision history [back]

click to hide/show revision 1
initial version

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,