How to get at the rgb values within a pcl::PointXYZRGB cloud
Hello all,
I am trying write a simple code to segment a red coloured tile on a desk, in rviz I can visualize the point cloud seen by the kinect and I have observed that it's rgb colour ranges from ~2.1810^-38 to ~2.2410^-38. I want to filter this out and find it's position.
So I have a loop on the coloured_cloud to fill the coloured_tile if it finds any points with this specific colour. With my desk rgb value at ~1.8*10^-38, an if-statement should segment the specific colour out and put it into coloured_tile.
double maxVal_RT = pow(2.18,-38.0);
double minVal_RT = pow(2.24,-38.0);
for (size_t l = 0; l < coloured_cloud->points.size(); l++)
{
if(coloured_cloud->points[l].rgb > minVal_RT && coloured_cloud->points[l].rgb < maxVal_RT)
coloured_tile->points.push_back(coloured_cloud->points[l]);
}
But this doesn't work and when I use ROS_INFO to see what these values it has for minVal_RT and maxVal_RT it says 0.00000 and coloured_cloud->points[l].rgb prints out nans.
It appears that maybe these values are too small to work with the way I am, is there another way to accomplish this? I just want to simply segment out this point cloud of a known, and static, colour.
Kind Regards, Martin