segmenting cow/pigs leg using pcl

Viewed 64

I'm trying to segment the leg to get 4 clusters of the point cloud. I tried conditional filtering, but it seems it doesn't work with all cases where there are missing points. Is there a clever to get the 4 legs clusters ?

Sample data:

https://www.mediafire.com/file/epglzuigetuw0n2/188262.pcd/file

result:

enter image description here

code:

pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_cluster_filtered(new pcl::PointCloud<pcl::PointXYZ>);
    
    pcl::PointXYZ minPt, maxPt;
    pcl::getMinMax3D(*orientedGolden, minPt, maxPt);

    float conditionYAxis = minPt.y + (maxPt.y - minPt.y) * 0.12;
    float conditionYAxis_ = conditionYAxis + (maxPt.y - minPt.y) * 0.10;

    pcl::ConditionAnd<pcl::PointXYZ>::Ptr range_cond(new
        pcl::ConditionAnd<pcl::PointXYZ>());
    range_cond->addComparison(pcl::FieldComparison<pcl::PointXYZ>::ConstPtr(new
        pcl::FieldComparison<pcl::PointXYZ>("y", pcl::ComparisonOps::GE, conditionYAxis)));
    range_cond->addComparison(pcl::FieldComparison<pcl::PointXYZ>::ConstPtr(new
        pcl::FieldComparison<pcl::PointXYZ>("y", pcl::ComparisonOps::LE, conditionYAxis_)));

    // build the filter
    pcl::ConditionalRemoval<pcl::PointXYZ> condrem;
    condrem.setCondition(range_cond);
    condrem.setInputCloud(orientedGolden);
    // apply filter
    condrem.filter(*cloud_cluster_filtered);

enter image description here

0 Answers
Related