Point cloud segmentation based on PCL region growing

Core of the algorithm: This algorithm is based on the comparison of angles between point normals, attempting to merge adjacent points that satisfy smooth constraints and output them in the form of a cluster of point sets. Each cluster point set is considered to belong to the same plane.

How it works: First of all, you need to understand that region growth starts from the point with the minimum curvature value. Therefore, we have to calculate all the curvature values ​​and sort them. This is because the points with the smallest curvature are in flat areas, and growing from the flattest areas reduces the total number of areas.

#include <iostream>
#include <vector>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/search/search.h>
#include <pcl/search/kdtree.h>
#include <pcl/features/normal_3d.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/filters/passthrough.h>
#include <pcl/segmentation/region_growing.h>

int main(int argc, char** argv) {
   
    
    
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
    if (pcl::io::loadPLYFile 

Guess you like

Origin blog.csdn.net/dyk4ever/article/details/128351985