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

#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

最新文章

  1. S5P4418开发板介绍
  2. 专为控制打印设计的CSS样式
  3. LeetCode Strobogrammatic Number
  4. 很实用的jQuery事件 - toggle() 方法
  5. iPhone socket 编程之BSD Socket篇
  6. 删除win7中的库/收藏夹/家庭组/网络
  7. Spring框架入门:(非原著,转载)
  8. PHP的接口(interface)
  9. Volley使用指南第四回(来自developer.android)
  10. DP——最优三角形剖分
  11. java通过解析文件获取apk版本等信息
  12. Quartz使用-入门使用(java定时任务实现)
  13. light oj 1422 - Halloween Costumes
  14. Hystrix快速入门
  15. MySQL的一些操作(学习记录_备忘)
  16. python 对时间操作
  17. centos7 hive + 远程mysql 搭建笔记
  18. 代码管理(二)sourcetree 安装与使用
  19. springboot+mybatis+mysql创建简单web后台项目
  20. TW实习日记:第18天

热门文章

  1. HTML5 FormData方法介绍
  2. VMware vSphere Client(Vcenter)上传ISO镜像
  3. linux软件管理 RPM命令
  4. leetcode python 006
  5. C语言打印杨辉三角(2种方法)
  6. 网络性能测试工具-Iperf
  7. linux安装mysql图文教程
  8. void的几点用法
  9. Android &amp; iOS 启动画面工具
  10. L2-005. 集合相似度(STL)*