随机采样一致分割法,从点云中分割出线、面等几何元素

#include <pcl/sample_consensus/method_types.h>
#include <pcl/sample_consensus/model_types.h>
#include <pcl/segmentation/sac_segmentation.h> // Create the segmentation object
pcl::SACSegmentation<pcl::PointXYZ> seg; // Optional
seg.setOptimizeCoefficients (true); // Mandatory
seg.setModelType (pcl::SACMODEL_PLANE); //model: plane
seg.setMethodType (pcl::SAC_RANSAC);

(1) SACMODEL_PLANE(三维平面)

  • used to determine plane models. The four coefficients of the plane are itsHessian Normal form: [normal_x normal_y normal_z d]

    • a : the X coordinate of the plane's normal (normalized)
    • b : the Y coordinate of the plane's normal (normalized)
    • c : the Z coordinate of the plane's normal (normalized)
    • d : the fourth Hessian component of the plane's equation
(2) SACMODEL_LINE(三维直线)
  • used to determine line models. The six coefficients of the line are given by a point on the line and the direction of the line as: [point_on_line.x point_on_line.y point_on_line.z line_direction.x line_direction.y line_direction.z]

    • point_on_line.x : the X coordinate of a point on the line
    • point_on_line.y : the Y coordinate of a point on the line
    • point_on_line.z : the Z coordinate of a point on the line
    • line_direction.x : the X coordinate of a line's direction
    • line_direction.y : the Y coordinate of a line's direction
    • line_direction.z : the Z coordinate of a line's direction
     
(3) SACMODEL_CIRCLE2D(二维圆)
  • used to determine 2D circles in a plane. The circle's three coefficients are given by its center and radius as: [center.x center.y radius]

    • center.x : the X coordinate of the circle's center
    • center.y : the Y coordinate of the circle's center
    • radius : the circle's radius
(4) SACMODEL_CIRCLE3D
  • not implemented yet

(5) SACMODEL_SPHERE(球)

  • used to determine sphere models. The four coefficients of the sphere are given by its 3D center and radius as: [center.x center.y center.z radius]

    • center.x : the X coordinate of the sphere's center
    • center.y : the Y coordinate of the sphere's center
    • center.z : the Z coordinate of the sphere's center
    • radius : the sphere's radius
(6) SACMODEL_CYLINDER(柱)
  • used to determine cylinder models. The seven coefficients of the cylinder are given by a point on its axis, the axis direction, and a radius, as: [point_on_axis.x point_on_axis.y point_on_axis.z axis_direction.x axis_direction.y axis_direction.z radius]
    • point_on_axis.x : the X coordinate of a point located on the cylinder axis
    • point_on_axis.y : the Y coordinate of a point located on the cylinder axis
    • point_on_axis.z : the Z coordinate of a point located on the cylinder axis
    • axis_direction.x : the X coordinate of the cylinder's axis direction
    • axis_direction.y : the Y coordinate of the cylinder's axis direction
    • axis_direction.z : the Z coordinate of the cylinder's axis direction
    • radius : the cylinder's radius
(7) SACMODEL_CONE 
  • not implemented yet
(8) SACMODEL_TORUS
  • not implemented yet

(9) SACMODEL_PARALLEL_LINE(平行线)

  • a model for determining a line parallel with a given axis, within a maximum specified angular deviation. The line coefficients are similar toSACMODEL_LINE.

The model coefficients are defined as:

    • point_on_line.x : the X coordinate of a point on the line
    • point_on_line.y : the Y coordinate of a point on the line
    • point_on_line.z : the Z coordinate of a point on the line
    • line_direction.x : the X coordinate of a line's direction
    • line_direction.y : the Y coordinate of a line's direction
    • line_direction.z : the Z coordinate of a line's direction
(10) SACMODEL_PERPENDICULAR_PLANE

  • a model for determining a plane perpendicular to an user-specified axis, within a maximum specified angular deviation. The plane coefficients are similar to SACMODEL_PLANE.
  • SampleConsensusModelPerpendicularPlane defines a model for 3D plane segmentation using additional angular constraints.The plane must be perpendicular to an user-specified axis (setAxis), up to an user-specified angle threshold (setEpsAngle).

The model coefficients are defined as:

    • a : the X coordinate of the plane's normal (normalized)
    • b : the Y coordinate of the plane's normal (normalized)
    • c : the Z coordinate of the plane's normal (normalized)
    • d : the fourth Hessian component of the plane's equation

Code example for a plane model, perpendicular (within a 15 degrees tolerance) with the Z axis:

 SampleConsensusModelPerpendicularPlane<pcl::PointXYZ> model (cloud);
model.setAxis (Eigen::Vector3f (0.0, 0.0, 1.0));
model.setEpsAngle (pcl::deg2rad ());
Note:
Please remember that you need to specify an angle > 0 in order to activate the axis-angle constraint!
 

(11) SACMODEL_PARALLEL_LINES

  • not implemented yet

(12) SACMODEL_NORMAL_PLANE

  • a model for determining plane models using an additional constraint: the surface normals at each inlier point has to be parallel to the surface normal of the output plane, within a maximum specified angular deviation. The plane coefficients are similar to SACMODEL_PLANE.
  • SampleConsensusModelNormalPlane defines a model for 3D plane segmentation using additional surface normal constraints.
  • Basically this means that checking for inliers will not only involve a "distance to model" criterion, but also an additional "maximum angular deviation" between the plane's normal and the inlier points normals.

The model coefficients are defined as:

    • a : the X coordinate of the plane's normal (normalized)
    • b : the Y coordinate of the plane's normal (normalized)
    • c : the Z coordinate of the plane's normal (normalized)
    • d : the fourth Hessian component of the plane's equation

To set the influence of the surface normals in the inlier estimation process, set the normal weight (0.0-1.0), e.g.:

 SampleConsensusModelNormalPlane<pcl::PointXYZ, pcl::Normal> sac_model;
...
sac_model.setNormalDistanceWeight (0.1);
...

(13) SACMODEL_PARALLEL_PLANE

  • a model for determining a plane parallel to an user-specified axis, within a maximim specified angular deviation. SACMODEL_PLANE.

Code example for a plane model, parallel (within a 15 degrees tolerance) with the Z axis:

 SampleConsensusModelParallelPlane<pcl::PointXYZ> model (cloud);
model.setAxis (Eigen::Vector3f (0.0, 0.0, 1.0));
model.setEpsAngle (pcl::deg2rad ());

(14) SACMODEL_NORMAL_PARALLEL_PLANE

  • defines a model for 3D plane segmentation using additional surface normal constraints. The plane must lieparallel to a user-specified axis. SACMODEL_NORMAL_PARALLEL_PLANE therefore is equivallent to SACMODEL_NORMAL_PLANE + SACMODEL_PARALLEL_PLANE. The plane coefficients are similar toSACMODEL_PLANE.
  • SampleConsensusModelNormalParallelPlane defines a model for 3D plane segmentation using additional surface normal constraints.
  • Basically this means that checking for inliers will not only involve a "distance to model" criterion, but also an additional "maximum angular deviation" between the plane's normal and the inlier points normals. In addition, the plane normal must lie parallel to an user-specified axis.

The model coefficients are defined as:

    • a : the X coordinate of the plane's normal (normalized)
    • b : the Y coordinate of the plane's normal (normalized)
    • c : the Z coordinate of the plane's normal (normalized)
    • d : the fourth Hessian component of the plane's equation

To set the influence of the surface normals in the inlier estimation process, set the normal weight (0.0-1.0), e.g.:

 SampleConsensusModelNormalPlane<pcl::PointXYZ, pcl::Normal> sac_model;
...
sac_model.setNormalDistanceWeight (0.1);
...

文章引用自 https://blog.csdn.net/sdau20104555/article/details/40649101

PCL中Sample_consensus分割支持的几何模型的更多相关文章

  1. 基于传统方法点云分割以及PCL中分割模块

      之前在微信公众号中更新了以下几个章节 1,如何学习PCL以及一些基础的知识 2,PCL中IO口以及common模块的介绍 3,PCL中常用的两种数据结构KDtree以及Octree树的介绍    ...

  2. PCL—点云分割(RanSaC)低层次点云处理

    博客转载自:http://blog.csdn.net/app_12062011/article/details/78131318 点云分割 点云分割可谓点云处理的精髓,也是三维图像相对二维图像最大优势 ...

  3. PCL点云分割(1)

    点云分割是根据空间,几何和纹理等特征对点云进行划分,使得同一划分内的点云拥有相似的特征,点云的有效分割往往是许多应用的前提,例如逆向工作,CAD领域对零件的不同扫描表面进行分割,然后才能更好的进行空洞 ...

  4. PCL点云分割(3)

    (1)Euclidean分割 欧几里德分割法是最简单的.检查两点之间的距离.如果小于阈值,则两者被认为属于同一簇.它的工作原理就像一个洪水填充算法:在点云中的一个点被“标记”则表示为选择在一个的集群中 ...

  5. PCL中的OpenNI点云获取框架(OpenNI Grabber Framework in PCL)

    从PCL 1.0开始,PCL(三维点云处理库Point Cloud Library)提供了一个通用采集接口,这样可以方便地连接到不同的设备及其驱动.文件格式和其他数据源.PCL集成的第一个数据获取驱动 ...

  6. kd-tree理论以及在PCL 中的代码的实现

    (小技巧记录:博客园编辑的网页界面变小了使用Ctrl  ++来变大网页字体) 通过雷达,激光扫描,立体摄像机等三维测量设备获取的点云数据,具有数据量大,分布不均匀等特点,作为三维领域中一个重要的数据来 ...

  7. PCL—点云分割(基于凹凸性) 低层次点云处理

    博客转载自:http://www.cnblogs.com/ironstark/p/5027269.html 1.图像分割的两条思路 场景分割时机器视觉中的重要任务,尤其对家庭机器人而言,优秀的场景分割 ...

  8. PCL—点云分割(最小割算法) 低层次点云处理

    1.点云分割的精度 在之前的两个章节里介绍了基于采样一致的点云分割和基于临近搜索的点云分割算法.基于采样一致的点云分割算法显然是意识流的,它只能割出大概的点云(可能是杯子的一部分,但杯把儿肯定没分割出 ...

  9. VS2010 MFC中 窗口分割的实现

    分割窗口概述 分割窗口,顾名思义,就是将一个窗口分割成多个窗格,在每个窗格中都包含有视图,或者是同一类型的视图,或者是不同类型的视图. MFC分割窗口的方式有两种,动态分割和静态分割. 动态分割窗口通 ...

随机推荐

  1. 5种网络IO模型(有图,很清楚)

    同步(synchronous) IO和异步(asynchronous) IO,阻塞(blocking) IO和非阻塞(non-blocking)IO分别是什么,到底有什么区别?这个问题其实不同的人给出 ...

  2. js创建对象的三种方法

    1.使用对象初始化器:{} var person = {....} 2 var person=new object() function person(参数) { this.参数=... } var ...

  3. Linux用户登录记录日志和相关查看命令汇总(转)

    # 1 utmp.wtmp.btmp文件 Linux用户登录信息放在三个文件中: 1 /var/run/utmp:记录当前正在登录系统的用户信息,默认由who和w记录当前登录用户的信息,uptime记 ...

  4. multipath配置详细参考

    1.配置文件结构及位置multipath配置文件/etc/multipath.conf由节(section),子节(sub-section),属性(atribute)和属性值(value)等组成,其结 ...

  5. Win10系列:C#应用控件基础23

    Telerik UI Controls for Windows 8 Telerik UI Controls for Windows 8是一套为创建Windows UWP应用而设计的工具集,开发人员可以 ...

  6. css3 二级菜单

    <!doctype html><!--<!DOCTYPE> 声明位于文档中的最前面的位置,处于 <html> 标签之前.此标签可告知浏览器文档使用哪种 HTM ...

  7. nopi 简洁笔记

    导出excel /// <summary> /// 增加二维码 /// </summary> /// <param name="dt">< ...

  8. 数的全排列 dfs深度优先搜索

    数的全排列. 输入格式: 一个n(n<10),表示长度 输出格式: 按字典序输出长度为n的所有排列,每个排列后需要换行,每个排列数字以空格分开. 输入样例: 在这里给出一组输入.例如: 3 输出 ...

  9. ipa 注入 dylib

    前些日子再github找到了一个内存修改器 DLGMemor 免越狱在app内植入修改器,感觉很不错,就尝试去看看是否可行. 用到的工具:  Xcode 10. optool 首先要做的,安装 opt ...

  10. linux下vim的安装及其设置细节

    第一步:使用apt安装vim sudo apt-get install vim 第二步:行号及其tab建设置 vim ~/.vimrc 添加如下文字 set nu //代码显示行号syntax on ...