How to extract rgb values separately from PointXYZRGBA ?

classic Classic list List threaded Threaded
1 message Options
HBR
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to extract rgb values separately from PointXYZRGBA ?

HBR
This post was updated on .
I have a pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud

how do i extract the values of the rgb ? I tried
uchar r = cloud->points[0].r;

but it doesn't work. help thanks

EDIT: I found the solution

Eigen::Vector3i rgb = cloud->points[i].getRGBVector3i();
cout << rgb[2] << " " << rgb[1] << endl;
Loading...