Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new PointCloudColorHandler for "label" field #849

Merged
merged 8 commits into from
Oct 1, 2014

Conversation

taketwo
Copy link
Member

@taketwo taketwo commented Aug 16, 2014

This pull request adds a new color handler specialized for the "label" field. It assigns colors to points based on the labels. The colors are taken from Glasbey lookup table to ensure max distinctiveness.

This addition allows an end user to easily visualize labeled point clouds by simply writing:

pcl::PointCloud<pcl::PointXYZL>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZL>);
pcl::visualization::PCLVisualizer viewer;
viewer.addPointCloud (cloud);

More specifically, this pull request:

  • Moves Glasbey lookup table from 'point_cloud_image_extractors.hpp' to pcl_common
    (because now it is needed in both pcl_io and pcl_visualization);
  • Updates the lookup table with nicer colors;
  • Adds PointCloudColorHandlerLabelField class;
  • Updates pcl_viewer app to use the new handler when "label" field is present;
  • Updates PCLVisualizer to provide convenience specializations for labeled points (PointXYZL).

@taketwo taketwo mentioned this pull request Aug 16, 2014
@jspricke jspricke added this to the pcl-1.8.0 milestone Aug 19, 2014
@taketwo
Copy link
Member Author

taketwo commented Sep 17, 2014

@jspricke Any comments on this one?

@jpapon
Copy link
Contributor

jpapon commented Oct 1, 2014

Any idea when this is going to be merged? It (and #718) are holding up some other changes I'd like to get into 1.8 early so they can be thoroughly tested =p

@jspricke
Copy link
Member

jspricke commented Oct 1, 2014

Sorry for taking so long, will merge once the style is fine.

@jspricke
Copy link
Member

jspricke commented Oct 1, 2014

@taketwo can you fix the merge errors, so I can hit the button? ;). Thanks!

@taketwo taketwo force-pushed the add-label-handler branch from b88e0f6 to 89b7b5b Compare October 1, 2014 20:18
@taketwo
Copy link
Member Author

taketwo commented Oct 1, 2014

Done

jspricke added a commit that referenced this pull request Oct 1, 2014
Add a new PointCloudColorHandler for "label" field
@jspricke jspricke merged commit be822ca into PointCloudLibrary:master Oct 1, 2014
@taketwo taketwo deleted the add-label-handler branch October 1, 2014 20:25
@jpapon
Copy link
Contributor

jpapon commented Oct 2, 2014

Awesome, thanks!

@jpapon
Copy link
Contributor

jpapon commented Oct 2, 2014

@taketwo I'm running into some issues with this - even with a fixed PointCloudColorHandlerLabelField, if I have more than GLASBEY_LUT_SIZE labels, both updatePointCloud and addPointCloud generate new random colors every time they're called.

Is there a way to pre-allocate a greater number of colors, or store random colors once they're generated?

@taketwo
Copy link
Member Author

taketwo commented Oct 2, 2014

Is there a way to pre-allocate a greater number of colors

Yes, but how many? 500, 1K, 2K, 100K? Where to stop?

What if we use label % GLASBEY_LUT_SIZE? The colors will repeat, but when there are so many labels it won't be possible to notice.

@jpapon
Copy link
Contributor

jpapon commented Oct 2, 2014

What if we use label % GLASBEY_LUT_SIZE? The colors will repeat, but when there are so many labels it won't be possible to notice.

This is the perfect solution +10

jpapon added a commit to jpapon/pcl that referenced this pull request Oct 2, 2014
jpapon added a commit to jpapon/pcl that referenced this pull request Oct 2, 2014
jpapon added a commit to jpapon/pcl that referenced this pull request Oct 2, 2014
@jpapon jpapon mentioned this pull request Oct 2, 2014
@taketwo
Copy link
Member Author

taketwo commented Oct 2, 2014

BTW this is exactly how I implemented it in PNG saving function. So both will be consistent now.

jpapon added a commit to jpapon/pcl that referenced this pull request Oct 3, 2014
…use the label field handlers from PointCloudLibrary#849 , deprecated functions return empty cloud to deprecated functions to avoid warnings

Changed labeled color handler to use modulo max color instead of using random colors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants