博客
关于我
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/

你可能感兴趣的文章
nginx + etcd 动态负载均衡实践(一)—— 组件介绍
查看>>
nginx + etcd 动态负载均衡实践(三)—— 基于nginx-upsync-module实现
查看>>
nginx + etcd 动态负载均衡实践(二)—— 组件安装
查看>>
nginx + etcd 动态负载均衡实践(四)—— 基于confd实现
查看>>
Nginx + Spring Boot 实现负载均衡
查看>>
Nginx + Tomcat + SpringBoot 部署项目
查看>>
Nginx + uWSGI + Flask + Vhost
查看>>
Nginx - Header详解
查看>>
nginx - thinkphp 如何实现url的rewrite
查看>>
Nginx - 反向代理、负载均衡、动静分离、底层原理(案例实战分析)
查看>>
Nginx - 反向代理与负载均衡
查看>>
nginx 1.24.0 安装nginx最新稳定版
查看>>
nginx 301 永久重定向
查看>>
nginx 301跳转
查看>>
nginx 403 forbidden
查看>>
nginx connect 模块安装以及配置
查看>>
nginx css,js合并插件,淘宝nginx合并js,css插件
查看>>
Nginx gateway集群和动态网关
查看>>
nginx http配置说明,逐渐完善。
查看>>
Nginx keepalived一主一从高可用,手把手带你一步一步配置!
查看>>