I would like convert pcd to image
Hello,
My question is: As can I visualize pcd files or the result of a function cloud_plane = cloud.extract(indices, negative=False) without rgb fiel (Can I see in rviz?)
The process is as follow:
I have a topic: /camera/depth/points [sensor_msgs/PointCloud2] And I get points this way (in phyton):
points = pc2.read_points(data,"x, y, z")
cloud= getCloud(points)
def getCloud(points):
points_cloud=[]
for point in points:
points_cloud.append([punto[0],punto[1],punto[2]])
cloud = pcl.PointCloud(np.array(pointscloud, dtype=np.float32))
return cloud
Without RGB field. Then exec RANSAC
seg = cloud.make_segmenter()
seg.set_model_type(pcl.SACMODEL_PLANE)
seg.set_method_type(pcl.SAC_RANSAC)
seg.set_distance_threshold(0.001)
seg.set_distance_threshold(0.03)
indices, model = seg.segment()
cloud_plane = cloud.extract(indices, negative=False)
cloud_plane.to_file("plane.pcd")
Plane.pcd is:
VERSION 0.7
FIELDS x y z
SIZE 4 4 4
TYPE F F F
COUNT 1 1 1
WIDTH 91259
HEIGHT 1
VIEWPOINT 0 0 0 1 0 0 0
POINTS 91259
DATA ascii
-4.4817686 0.35769984 7.7747769
-4.4677291 0.35769889 7.7747564
-4.4536958 0.35769838 7.7747455
-4.4396615 0.35769784 7.7747335
-4.4256258 0.35769719 7.7747192
-4.4115911 0.35769659 7.7747064
-4.3975549 0.35769585 7.7746902
ETC.
Some answer?
Thanks !!