retrieve rgb from kinect pointcloud
Hello! The pointcloud published at camera/rgb/points is sensed to have the rgb at the fourth float
rostopic echo /camera/rgb/points/fields
-
name: x
offset: 0
datatype: 7
count: 1
-
name: y
offset: 4
datatype: 7
count: 1
-
name: z
offset: 8
datatype: 7
count: 1
-
name: rgb
offset: 16
datatype: 7
count: 1
---
However, when storing the float with
float *pstep2 = (float*)&msg->data[(kk) * msg->point_step];
xi[kk] = pstep2[0]; //x
yi[kk] = pstep2[1]; //y
zi[kk] = pstep2[2]; //z
ci[kk] = pstep2[3]; //rgb
and printing out the float shows how all of them are set to zero.
How can we retrieve the associated rgb values for each 3d point of the pointcloud output by the kinect?