-
-
Notifications
You must be signed in to change notification settings - Fork 469
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
visualize labeled points in point cloud with different colors #1074
visualize labeled points in point cloud with different colors #1074
Conversation
I'll review this asap, but in the meantime I wanted to suggest some alternatives you could do without modification. I believe that you could color by label already if it were a scalar index (an int) rather than a string by using the "rainbow coloring" feature. I'd have to try it with your specific point cloud, but it might be possible with the current features. However, it might not give as much control over the visualization as your patch. |
After looking at the code and looking at your point cloud data, I think it is because the function The other thing that I noticed is that if I select your pointcloud's points in rviz and look at the value for label, a few are normal integers, but others are large floating point numbers: So, I don't know if it is your data or the fact that rainbow coloring expects the channel (in this case "label") to be a floating point number between 0 and 1. Either way, if you have control over your data's creation I'd advise trying out some different values for label and ensure you're putting the correct information into that channel for each point. As for this patch, I don't think looking for a channel called "label" explicitly is very flexible. I'd rather see additional options for how rviz maps values in a channel to point colors than what's proposed here. |
@wjwwood i needed something similar but w/ ability to name/alias labels + set colors so did that @ https://github.com/dispatch-ai/rviz-labeled-point-cloud. if you are interested i can submit it for merge. |
@daizr pr's are always welcome. We'll do our best to merge it at some point, but at the very least others can see it and perhaps iterate on it. |
I don't have access to your specific point cloud, @NamanCMU, but from what wjwwood mentioned it must be using UINT_MAX for some of its labels. I suspect this is the reason why rainbow colouring wasn't sufficient, because that colouring scheme by default will auto-compute the range of intensity values, which it uses for the mapping of intensities onto the 0-to-1 rainbow range. Your range would have been very large, and so all labels around 0, e.g. 0-20, would have mapped to roughly the same colour the rainbow scale (red). If instead you deselect "Autocompute Intensity Bounds" in rviz and set the max intensity to the number of labels-1, you will be able to utilise the full rainbow range for your labels. However, if the range of the labels is still large, then there won't be much colour distinction between similarly-numbered labels. At that point we can introduce additional properties for the Intensity colour transformer (such as modulo like you have incorporated in this PR), but that won't guarantee you colour distinction in space either (if labels 1 and 11 are next to each other), so we are probably better off considering an approach to colouring the label data that allows user modification, e.g. #1162, which has since been proposed. You are welcome to try out that PR and give feedback, I suspect it will fit your use case nicely especially if you have high range in your labels. |
I imagine that you have already resolved/worked around your issue, @NamanCMU, so I am going to close this PR. If other users encounter the same situation, I think it's possible to resolve without this PR. For data labeled integers, rainbow colouring should be sufficient, provided that "autocompute intensity bounds" is deselected. If a use case comes up where the modulo approach to colouring is more appropriate than rainbow, this PR can be revived. Thanks again for proposal! |
…ualization#1099) * Rolling namespace in title (ros-visualization#1074) Signed-off-by: Markus Bader <[email protected]> Co-authored-by: Chris Lalancette <[email protected]> (cherry picked from commit ea2dbb3097f095dd24add190c242f3048a747c63) Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Added a small piece of code to visualize points with different labels in the point cloud with different colors (10 for now, can be increased).
To use it, in the PointCloud2 plugin in RVIZ, set ColorTransformer to Intensity and then change Channel Name to label. Note this requires that label is added as an entry in the PointField[] in the sensor_msgs/PointCloud2 entry. All the points with the same label are assigned the same color. This is useful to visualize point clusters representing objects, ground plane with the same color.