Cylinder segmentation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Cylinder segmentation


I would like to extract pipes from 3D point cloud by using sac segmentation.

I created a toy example (I was following mainly I
created two programmes: one to generate a point cloud of the pipe(with given
radius and length) and the other to read data from the external file and do
a cylinder segmentation. As a result, I get the following situation (these
cylinders are aligned, but there is an offset in origins, the second
cylinder is generated by pcl_viewer)


My code which should extract a cylinder:

    ne.setSearchMethod (tree);
    ne.setInputCloud (cloud_filtered);
    ne.setKSearch (50);
    ne.compute (*cloud_normals);

    seg.setOptimizeCoefficients (true);
    seg.setModelType (pcl::SACMODEL_CYLINDER);
    seg.setMethodType (pcl::SAC_RANSAC);
    seg.setNormalDistanceWeight (0.1);
    seg.setMaxIterations (10000);
    seg.setDistanceThreshold (0.05);
    seg.setRadiusLimits (0.02,0.2);
    seg.setInputCloud (cloud_filtered);
    seg.setInputNormals (cloud_normals);
    seg.segment (*inliers_cylinder, *coefficients_cylinder);

Can you give me hints what should I do in order to have a match between
those two point clouds? I should add also that I implemented this also in
ROS, and the same thing is happening with real data, so I don't have
alignment, I have the offset.

Sent from:
[hidden email] /