ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
-1

I would like convert pcd to image

asked 2015-04-05 11:39:06 -0500

Lucer gravatar 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 !!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-05-01 10:41:32 -0500

If you would like to see what points are part of the plane detected by RANSAC, publish your cloud variable to a PointCloud2 topic after it's been detected. Publish to a new topic name and display this PointCloud2 topic in RViz, and set the color to be different from the color of your other point clouds in the scene. Then it should be easy to see your detected plane.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-04-05 11:39:06 -0500

Seen: 1,102 times

Last updated: May 01 '15