PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.89k stars 4.61k forks source link

Visualizer: color coding of multiple point clouds #576

Open schapotschnikow opened 10 years ago

schapotschnikow commented 10 years ago

I noticed the following behavior of the PCLvisualizer when using PointCloudColorHandlerGenericField for color coding. This is used, for example, to color the points according to a specific scalar feature. Example:

PointCloud<PointXYZI>::Ptr cloud;
/*
Fill the cloud somehow. Write the feature value to the intensity-field of the points.
*/
pcl::visualization::PCLVisualizer viewer;
pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZI> handler(cloud,"intensity");
string cloud_id = "My cloud";
viewer.addPointCloud<PointXYZI>(cloud,handler,cloud_id);

When you add multiple point clouds, each point cloud is colored according to its own range of intensity. If you display the legend (color bar) in the visualizer, it makes little sense, as you don't even know, to which cloud it belongs. But what you, probably, want, is that all clouds are colored according to the same range, and the color scale is the same for all clouds.

There are, of course, different ways to get the expected behavior. IMHO, the easiest one is to add a method in the PCLvisualizer class, something like PCLVisualizer::alignColorScales(string field, int viewport = 0);

nizar-sallem commented 10 years ago

I would rather argue for a boolean check in the method addPointCloud (cloud, handler, cloud_id, use_global_color_scale) which internally calls alignColorScales.

schapotschnikow commented 10 years ago

This makes sense, I like the idea with the boolean use_global_color_scale. There is one issue, however. The call goes to

template bool addPointCloud (const typename pcl::PointCloud::ConstPtr &cloud, const PointCloudColorHandler &color_handler, const std::string &id = "cloud", int viewport = 0);

The only child class of PointCloudColorHandler that would require the boolean use_global_color_scale is PointCloudColorHandlerGenericFieldpcl::PointXYZI. So why not to put this boolean somewhere inside this handler?!

BTW, it might also be useful to have a second boolean adapt_global_color_scale, to tell the color handler if the global scale must be adapted to the new data or not.

stale[bot] commented 4 years ago

Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.

kunaltyagi commented 4 years ago

The only child class of PointCloudColorHandler that would require the boolean use_global_color_scale is PointCloudColorHandlerGenericFieldpcl::PointXYZI. So why not to put this boolean somewhere inside this handler?! BTW, it might also be useful to have a second boolean adapt_global_color_scale, to tell the color handler if the global scale must be adapted to the new data or not.

This has 2 items. Which one is the proposal?