This is the normals estimation of every point using covariance matrix
Here is my code:
pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>);
pcl::NormalEstimation<pcl::PointXYZRGB, pcl::Normal> ne;
pcl::search::KdTree<PointT>::Ptr tree(new pcl::search::KdTree<PointT>);
pcl::OrganizedMultiPlaneSegmentation<PointT, pcl::Normal, pcl::Label> seg;
pcl::IntegralImageNormalEstimation<PointT, pcl::Normal> ne_normals;
std::vector<pcl::PlanarRegion<PointT>, Eigen::aligned_allocator<pcl::PlanarRegion<PointT>>> regions;
cout << "start segmentation and display" << endl;
start = clock();
ne_normals.setNormalEstimationMethod(ne_normals.COVARIANCE_MATRIX);
ne_normals.setMaxDepthChangeFactor(0.1f);
ne_normals.setNormalSmoothingSize(20.0f);
ne_normals.setInputCloud(this->cloud);
ne_normals.compute(*normals);
finish = clock();
total_time = (double)(finish - start) / CLOCKS_PER_SEC;
cout << "normal estimation TIME=" << total_time << endl;
start = clock();
seg.setInputCloud(this->cloud);
seg.setInputNormals(normals);
seg.setMinInliers(100); //the minimum points a plane contain
seg.setAngularThreshold(0.12);
seg.setDistanceThreshold(2);
seg.segment(coefficients_vector, inliers_vector);
finish = clock();
total_time = (double)(finish - start) / CLOCKS_PER_SEC;
Here is the segment result:
$:Start segmentation and display
$:normal setimation TIME=9.563
$:seg TIME=11.138
$:segmented planes number:2
$: Plane 1 contains:170 points
$: Plane 2 contains:169 points
Question: From the normal estimation result,the estimation is not bad, why the multiplaneSeg are very few and bad? Anyone could help me?
this is the original picture(640*480) got from kinect,and plot seg result in it