Read colours from a pointcloud2 python
Hi all,
My issue is the following:
I have a kinect sensor and I want to parse its point cloud using Python. I have subscribed to the topic and I am able to retrieve positional information of the pointcloud(x,y,z)
I now also need colour information but the read_points API does not seem to provide such functionality
Is there any other tool I can use to also extract the colours in python? It seems I am doing something wrong since taking the point in cpp is, and I cannot believe I'm saying this, easier.
My code so far in the point extraction part is the following:
import sensor_msgs.point_cloud2 as pc2
...............
# subscribe to pointcloud topic define the function that does the parsing
def PointCloud(self, PointCloud2):
self.lock.acquire()
gen = pc2.read_points(PointCloud2, skip_nans=True, field_names=("x" , "y" , " z" ))
int_data = list(gen)
print int_data[0] #Gives first point etc
self.lock.release()
I tried adding field_names but the read_points API made it clear it does not work that way. Any thoughts on a fast way to also extract colour info from my pointcloud?
Thanks in advance,
Panos