PCL中Sample_consensus模块支持的几何模型

2023-11-06 22:58

本文主要是介绍PCL中Sample_consensus模块支持的几何模型,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

As of PCL 1.0, the following models are supported: 

(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. 

SampleConsensusModelParallelLine defines a model for 3D line segmentation using additional angular constraints.  

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 (15));
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. 

SampleConsensusModelParallelPlane defines a model for 3D plane segmentation using additional angular constraints.

The plane must be parallel to a user-specified axis (setAxis) within an user-specified angle threshold (setEpsAngle).

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 (15));

(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);...
举例:(使用参数化模型投影点云到三维平面)

用到ModelCoefficients结构和ProjectInliers滤波器

说明:填充ModelCoefficients的值,例子中使用了一个ax+by+cz+d=0的平面模型,其中a=b=d=0,c=1;

创建了ProjectInliers对象,并使用刚定义好的 ModelCoefficients作为投影对象的模型参数。


#include<iostream>
#include<pcl\point_cloud.h>
#include<pcl\point_types.h>
#include<pcl\ModelCoefficients.h>
#include<pcl\filters\project_inliers.h>
using namespace std;
int main()
{pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_projected(new pcl::PointCloud<pcl::PointXYZ>);cloud->width=5;cloud->height=1;cloud->points.resize(cloud->width*cloud->height);for(size_t i=0;i<cloud->points.size();i++){cloud->points[i].x=1024*rand()/(RAND_MAX+1.0f);cloud->points[i].y=1024*rand()/(RAND_MAX+1.0f);cloud->points[i].z=1024*rand()/(RAND_MAX+1.0f);}std::cerr<<"Cloud before projection:"<<std::endl;for(size_t i=0;i<cloud->points.size();i++)std::cerr<<' '<<cloud->points[i].x<<' '<<cloud->points[i].y<<' '<<cloud->points[i].z<<std::endl;//定义模型系数对象,并填充对应的数据pcl::ModelCoefficients::Ptr coefficients(new pcl::ModelCoefficients());coefficients->values.resize(4);coefficients->values[0]=coefficients->values[1]=coefficients->values[3]=0;coefficients->values[2]=1.0;pcl::ProjectInliers<pcl::PointXYZ> proj;//创建投影滤波对象proj.setModelType(pcl::SACMODEL_PLANE);//设置对象对应的投影模型proj.setInputCloud(cloud);      //设置输入点云proj.setModelCoefficients(coefficients);//设置模型对应的系数proj.filter(*cloud_projected);std::cerr<<"Cloud after projection:"<<std::endl;for(size_t i=0;i<cloud->points.size();i++)std::cerr<<' '<<cloud_projected->points[i].x<<' '<<cloud_projected->points[i].y<<' '<<cloud_projected->points[i].z<<std::endl;system("pause");return 0;
}

总结:投影钱的z轴都不为0,是随机产生的值,投影之后,打印结果表明,x,y没有改变,z都变成0。

该投影滤波类输入为点云和投影模型,输出为投影到模型上之后的点云。

这篇关于PCL中Sample_consensus模块支持的几何模型的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/359554

相关文章

Python中构建终端应用界面利器Blessed模块的使用

《Python中构建终端应用界面利器Blessed模块的使用》Blessed库作为一个轻量级且功能强大的解决方案,开始在开发者中赢得口碑,今天,我们就一起来探索一下它是如何让终端UI开发变得轻松而高... 目录一、安装与配置:简单、快速、无障碍二、基本功能:从彩色文本到动态交互1. 显示基本内容2. 创建链

Node.js 中 http 模块的深度剖析与实战应用小结

《Node.js中http模块的深度剖析与实战应用小结》本文详细介绍了Node.js中的http模块,从创建HTTP服务器、处理请求与响应,到获取请求参数,每个环节都通过代码示例进行解析,旨在帮... 目录Node.js 中 http 模块的深度剖析与实战应用一、引言二、创建 HTTP 服务器:基石搭建(一

Python基于火山引擎豆包大模型搭建QQ机器人详细教程(2024年最新)

《Python基于火山引擎豆包大模型搭建QQ机器人详细教程(2024年最新)》:本文主要介绍Python基于火山引擎豆包大模型搭建QQ机器人详细的相关资料,包括开通模型、配置APIKEY鉴权和SD... 目录豆包大模型概述开通模型付费安装 SDK 环境配置 API KEY 鉴权Ark 模型接口Prompt

python中的与时间相关的模块应用场景分析

《python中的与时间相关的模块应用场景分析》本文介绍了Python中与时间相关的几个重要模块:`time`、`datetime`、`calendar`、`timeit`、`pytz`和`dateu... 目录1. time 模块2. datetime 模块3. calendar 模块4. timeit

Python模块导入的几种方法实现

《Python模块导入的几种方法实现》本文主要介绍了Python模块导入的几种方法实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学... 目录一、什么是模块?二、模块导入的基本方法1. 使用import整个模块2.使用from ... i

大模型研发全揭秘:客服工单数据标注的完整攻略

在人工智能(AI)领域,数据标注是模型训练过程中至关重要的一步。无论你是新手还是有经验的从业者,掌握数据标注的技术细节和常见问题的解决方案都能为你的AI项目增添不少价值。在电信运营商的客服系统中,工单数据是客户问题和解决方案的重要记录。通过对这些工单数据进行有效标注,不仅能够帮助提升客服自动化系统的智能化水平,还能优化客户服务流程,提高客户满意度。本文将详细介绍如何在电信运营商客服工单的背景下进行

python: 多模块(.py)中全局变量的导入

文章目录 global关键字可变类型和不可变类型数据的内存地址单模块(单个py文件)的全局变量示例总结 多模块(多个py文件)的全局变量from x import x导入全局变量示例 import x导入全局变量示例 总结 global关键字 global 的作用范围是模块(.py)级别: 当你在一个模块(文件)中使用 global 声明变量时,这个变量只在该模块的全局命名空

深入探索协同过滤:从原理到推荐模块案例

文章目录 前言一、协同过滤1. 基于用户的协同过滤(UserCF)2. 基于物品的协同过滤(ItemCF)3. 相似度计算方法 二、相似度计算方法1. 欧氏距离2. 皮尔逊相关系数3. 杰卡德相似系数4. 余弦相似度 三、推荐模块案例1.基于文章的协同过滤推荐功能2.基于用户的协同过滤推荐功能 前言     在信息过载的时代,推荐系统成为连接用户与内容的桥梁。本文聚焦于

Andrej Karpathy最新采访:认知核心模型10亿参数就够了,AI会打破教育不公的僵局

夕小瑶科技说 原创  作者 | 海野 AI圈子的红人,AI大神Andrej Karpathy,曾是OpenAI联合创始人之一,特斯拉AI总监。上一次的动态是官宣创办一家名为 Eureka Labs 的人工智能+教育公司 ,宣布将长期致力于AI原生教育。 近日,Andrej Karpathy接受了No Priors(投资博客)的采访,与硅谷知名投资人 Sara Guo 和 Elad G

Retrieval-based-Voice-Conversion-WebUI模型构建指南

一、模型介绍 Retrieval-based-Voice-Conversion-WebUI(简称 RVC)模型是一个基于 VITS(Variational Inference with adversarial learning for end-to-end Text-to-Speech)的简单易用的语音转换框架。 具有以下特点 简单易用:RVC 模型通过简单易用的网页界面,使得用户无需深入了