What mean is "where R, G, B, and alpha channels (4 x 8-bit) are concatenated into a single 32-bit float."

I get the last float data at pointcloud API,

point_cloud = sl.Mat()
zed.retrieve_measure(point_cloud, sl.MEASURE.XYZRGBA)

the data demo is “-300921531830117489423516037643325407232.00000”,I don’t how concatenated R,G,B,A,and I don’t know how get the real data of R,G,B,A.
Can someone help me?thanks!

Hi @CharlesDCXX,

The last coordinate of your point_cloud mat indeed contains your color information. It is represented as an array of 4 unsigned char stored into a 32-bit float. In order to extract the 4 unsigned char values, you can use the following code snippet (using the Python struct package - doc here):

import struct

err, point_cloud_value = point_cloud.get_data(x,y)    # Get your point cloud value at pixel (x,y)
packed = struck.pack('f', point_cloud_value[3])
char_array = struct.unpack('BBBB', packed)
print("(R,G,B,A) = {}".format(char_array))

It indeed does not appear in the documentation and it will be added for more clarity.
Hope it helps !

1 Like

This is exactly what i need!!