Created
November 13, 2020 12:34
-
-
Save shubhamwagh/6932e34cbfa9e83d6c15fa1700571f33 to your computer and use it in GitHub Desktop.
ROS PointClou2 to numpy conversion (this will avoid bit flip)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colours = np.array([ | |
bytearray(msg.data[rgb_field.offset + 2::msg.point_step]), | |
bytearray(msg.data[rgb_field.offset + 1::msg.point_step]), | |
bytearray(msg.data[rgb_field.offset + 0::msg.point_step]) | |
]).transpose().astype(np.float32)/255.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reading it directly from the data buffer preserves colour data.