博客
关于我
PCL滤波 ProjectInliers平面投射
阅读量:238 次
发布时间:2019-03-01

本文共 1310 字,大约阅读时间需要 4 分钟。

#include 
#include
#include
#include
#include
intmain(int argc,char ** args){ pcl::PointCloud
::Ptr cloud(new pcl::PointCloud
()); pcl::PointCloud
::Ptr cloud_pj(new pcl::PointCloud
()); cloud->width = 5; cloud->height = 1; cloud->points.resize(cloud->width * cloud->height); for (auto& p : *cloud) { p.x = 1024 * rand() / (RAND_MAX + 1.0f); p.y = 1024 * rand() / (RAND_MAX + 1.0f); p.z = 1024 * rand() / (RAND_MAX + 1.0f); } std::cerr << "cloud before projection" << std::endl; for (const auto& p : *cloud) std::cout << " " << p.x << " " << p.y << " " << p.z << " " << std::endl; pcl::ModelCoefficients::Ptr mc(new pcl::ModelCoefficients()); //平面模型的方程为 ax+by+cz+d = 0,此时设置 a = b = d = 0,c =1,则平面为 z=0的平面,也就是 X-Y平面 //mc->values.resize(4); //mc->values[0] = mc ->values[1] = 0; //mc->values[2] = 1.0; //mc->values[3] = 0; //投射可以是任意的平面 mc->values.resize(4); mc->values[0] = mc->values[1] = 2; mc->values[2] = 1.0; mc->values[3] = 0; pcl::ProjectInliers
proj; proj.setModelType(pcl::SACMODEL_PLANE); proj.setInputCloud(cloud); proj.setModelCoefficients(mc); proj.filter(*cloud_pj); std::cerr << "Cloud after projection" << std::endl; for(const auto & p :*cloud_pj) std::cout << " " << p.x << " " << p.y << " " << p.z << " " << std::endl; return 0;}

转载地址:http://wrct.baihongyu.com/

你可能感兴趣的文章
mysql 让所有IP访问数据库
查看>>
MySQL 高可用性之keepalived+mysql双主
查看>>
mysql5.6.21重置数据库的root密码
查看>>
MySQL5.6忘记root密码(win平台)
查看>>
mysql5.7 for windows_MySQL 5.7 for Windows 解压缩版配置安装
查看>>
mysql5.7性能调优my.ini
查看>>
mysql5.7的安装和Navicat的安装
查看>>
MySQL8.0.29启动报错Different lower_case_table_names settings for server (‘0‘) and data dictionary (‘1‘)
查看>>
MySQL8修改密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
查看>>
mysqlbinlog报错unknown variable ‘default-character-set=utf8mb4‘
查看>>
mysqldump 导出中文乱码
查看>>
mysqldump备份时忽略某些表
查看>>
mysqlreport分析工具详解
查看>>
MySQL一个表A中多个字段关联了表B的ID,如何关联查询?
查看>>
MYSQL一直显示正在启动
查看>>
MySQL一站到底!华为首发MySQL进阶宝典,基础+优化+源码+架构+实战五飞
查看>>
MySQL万字总结!超详细!
查看>>
Mysql下载以及安装(新手入门,超详细)
查看>>
mysql中cast() 和convert()的用法讲解
查看>>
mysql中floor函数的作用是什么?
查看>>