简体   繁体   English

获取飞机的角点

[英]Getting corner points of a plane

Based on this tutorial: http://pointclouds.org/documentation/tutorials/planar_segmentation.php 基于本教程: http : //pointclouds.org/documentation/tutorials/planar_segmentation.php

I have segmented my planes as stated in the tutorial 我按照教程中的说明对飞机进行了细分

pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients);
pcl::PointIndices::Ptr inliers (new pcl::PointIndices);   // Create the segmentation object  
pcl::SACSegmentation<pcl::PointXYZ> seg;   // Optional  
seg.setOptimizeCoefficients (true);   // Mandatory   
seg.setModelType(pcl::SACMODEL_PLANE);
seg.setMethodType (pcl::SAC_RANSAC);  
seg.setDistanceThreshold (0.01);
seg.setInputCloud (cloud);   
seg.segment (*inliers, *coefficients);

if (inliers->indices.size() == 0) {
   PCL_ERROR ("Could not estimate a planar model for the given dataset.");
   return (-1);  
}

std::cerr << "Model coefficients: " << coefficients->values[0] << " " 
                      << coefficients->values[1] << " "
                      << coefficients->values[2] << " " 
                      << coefficients->values[3] << std::endl;

Now, I'd like to know if there is a way to get the corner points. 现在,我想知道是否有办法获得拐角点。 Or if such a method is available in PCL? 还是PCL中提供了这种方法?

If not, how may I solve this problem. 如果没有,我该如何解决这个问题。

When you segment a plane in a point cloud, you find points lying on the same plane; 在点云中分割平面时,会发现位于同一平面上的点。 the output is not necessarily a rectangle or a square; 输出不一定是矩形或正方形; so the corners might not exists at all. 因此角落可能根本不存在。

What you could do is create a polygon but iterating over the outside points of the points an build a polygon. 您可以做的是创建一个多边形,然后迭代这些点的外部点以构建一个多边形。 Take a look at the 2D hull PCL tutorial on how to build a hull from a set of points lying on a plane. 看一下2D船体PCL教程 ,该教程介绍了如何根据平面上的一组点来构建船体。

After that you can estimate the angles at each point of your polygon thanks to the previous and next vectors. 之后,由于有了上一个和下一个向量,您可以估算多边形每个点的角度。 Beware of concave polygons with angle greater than 180°! 当心凹角大于180°的多边形!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM