bandini Posted July 25, 2012 Share Posted July 25, 2012 I started to write a .pcd importer in python to import files using the point cloud data format (http://pointclouds.org/documentation/tutorials/pcd_file_format.php). I have xyz position taken care of, but I don't exactly understand how to extract the color information from the file. Hoping someone here can provide a short code snippet. The documentation indicates that the color is encoded as a packed uint32_t rgba value. Their packing and unpacking method is easy to see in C++, as described here: http://docs.pointclouds.org/1.3.0/structpcl_1_1_r_g_b.html However, since I have the packed data written out as an ACSII file, what would be the code needed to unpack that in python? For instance, just the value 4.2108e+06 How to go about unpacking that into color values? That value comes from the test file in the first link above. Thanks! Adam Quote Link to comment Share on other sites More sharing options...
Solitude Posted August 1, 2012 Share Posted August 1, 2012 I believe it's almost exactly as written there: rgb = 4.2108e+06 r = (rgb >> 16) & 0x0000ff g = (rgb >> 8) & 0x0000ff b = (rgb) & 0x0000ff a = (rgb >> 24) & 0x0000ff Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.