当前位置: 首页 > wzjs >正文

网站建设评比办法营销网站建设创意

网站建设评比办法,营销网站建设创意,阳江网上车管所,wordpress写文件到磁盘失败PCL常用的点云操作 1、PCL有序点云分析2、PCL绘制直线3、获取点云质心4、判断点云是否是非数5、移除无效点6、PCL计算两点之间的欧式距离 1、PCL有序点云分析 对于有序点云可以通过 at 的方式访问,但是,需要注意的是,正确的访问方式是 at(w, …

PCL常用的点云操作

  • 1、PCL有序点云分析
  • 2、PCL绘制直线
  • 3、获取点云质心
  • 4、判断点云是否是非数
  • 5、移除无效点
  • 6、PCL计算两点之间的欧式距离

1、PCL有序点云分析

在这里插入图片描述
对于有序点云可以通过 at 的方式访问,但是,需要注意的是,正确的访问方式是 at(w, h)。

//读写
#include <pcl/io/pcd_io.h> 
#include <pcl/point_types.h>  typedef pcl::PointXYZ PointT;
typedef pcl::PointCloud<PointT> PointCloudT;
//读取点云示例
int main()
{PointCloudT::Ptr mpCloudSource;mpCloudSource.reset(new(PointCloudT));pcl::PCDReader reader;int sucess = reader.read(PointPath, *mpCloudSource);if (sucess == -1){std::cout << "read point file failure!..." << std::endl;return -1;}//访问有序点云数据for (int i = 0; i < mpCloudSource->width; i++){for (int j = 0; j < mpCloudSource->height; j++){pcl::PointXYZ pointcloud = mpCloudSource->at(width, height);}}
}

2、PCL绘制直线

绘制直线(每条线段1个唯一的id符,不然的话只能画出一条线):

//cloudOut->points.size():所有的直线点
for (int i = 0; i < cloudOut->points.size() - 1; i++)
{std::string id = "line_" + std::to_string(i);viewer.addLine(cloudOut->points[i], cloudOut->points[i + 1], 0.0, 0.0, 1.0, id, v1);viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_LINE_WIDTH, 6, id);
}
viewer.addText("points trajectory line", 10, 920, 16, bckgr_gray_level, bckgr_gray_level, txt_gray_lvl, "line", v1);

3、获取点云质心

获取点云的质心有两种方式,一种是pcl自带的API:pcl::compute3DCentroid(*cloud, centroid);,另一种是用数学的方式求所有点坐标的平均值。下面的代码实现了这两种方式。

#include <iostream>
#include <Eigen/Core>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/common/centroid.h>
#include <pcl/common/transforms.h>using namespace std;
typedef pcl::PointCloud<pcl::PointXYZ> Cloud;
int main(int argc, char **argv)
{// 生成一个正方形点云Cloud::Ptr cloud(new Cloud);cloud->width = 10000;cloud->height = 1;cloud->is_dense = false;cloud->points.resize(cloud->width * cloud->height);  for (int i = 0; i < cloud->points.size(); i++){cloud->points[i].x=1000* (rand() / (RAND_MAX + 1.0f));cloud->points[i].y=1000* (rand() / (RAND_MAX + 1.0f));cloud->points[i].z=0;}// 方式1:利用PCL函数计算质心Eigen::Vector4f centroid;                    // 质心pcl::compute3DCentroid(*cloud, centroid);    // 齐次坐标,(c0,c1,c2,1)// 方式2:利用公式计算质心pcl::PointXYZ p_c;p_c.x = 0; p_c.y = 0; p_c.z = 0;for (auto p : cloud->points) {p_c.x += p.x;p_c.y += p.y;p_c.z += p.z;}p_c.x /= cloud->points.size();p_c.y /= cloud->points.size();p_c.z /= cloud->points.size();// 结果对比cout << "pcl 函数计算点云质心结果:(" << centroid(0)<<","<<centroid(1)<<","<<centroid(2)<<")" << endl;cout << "按照公式计算点云质心结果:" << p_c<< endl;return 0;
}

4、判断点云是否是非数

pcl::PointXYZ pointcloud = cloudDownSampling->points[idx];
if (!isFinite(pointcloud)) //不是有效点continue;

5、移除无效点

// Object for storing the point cloud.
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGB>);
// Read a PCD file from disk.
if (pcl::io::loadPCDFile<pcl::PointXYZRGB>(argv[1], *cloud) != 0)
{return -1;
}
// The mapping tells you to what points of the old cloud the new ones correspond,
// but we will not use it.
std::vector<int> mapping;
pcl::removeNaNFromPointCloud(*cloud, *cloud, mapping);

6、PCL计算两点之间的欧式距离

for(int i=0;i<cloud->points.size()-1;i++)
{float dis=pcl::euclideanDistance(cloud->points[i],cloud->points[i+1]);
}

###################################未完待续###################################

http://www.dtcms.com/wzjs/122994.html

相关文章:

  • 通化 网站建设seo网站优化推广费用
  • 做购物网站的初衷行业关键词分类
  • 花都移动网站建设网络优化的意义
  • 网站多大网络营销推广策划案例
  • 食品网站的网页设计磁力狗最佳搜索引擎
  • 做网站能挣钱吗网站制作教程视频
  • 网站建设 快速百度seo正规优化
  • 亿牛网汕头seo优化
  • 网站服务运营队伍与渠道建设海淀区seo搜索优化
  • 海淀周边网站建设万网注册域名查询
  • 西安市建设工程信息网工程交易平台官网宁波seo推广推荐
  • 照片管理网站模板下载商丘seo推广
  • html5 网站 适配手机广州seo代理
  • 黄村做网站的公司引擎网站
  • 泰安做网站优化培训网站设计
  • 怎么建一个免费的网站网站推广费用
  • 一个网站的二级目录在另一台服务器上_怎么做市场调研一般怎么做
  • seo网站排名游戏推广话术技巧
  • wordpress 建站赚钱西安疫情最新数据消息中高风险地区
  • 建设网站需要做什么的手机网站建设价格
  • 阜宁做网站需要多少钱惠州seo快速排名
  • 各网站文风关键词优化seo排名
  • b站推广网站2024大全微信营销模式
  • asp.net企业网站模板品牌网络seo方案外包
  • 深圳建设企业网站公司seo一键优化
  • cn域名做犯法网站百度推广员工工资怎么样
  • 网站建设三个友好吴江seo网站优化软件
  • wordpress谷歌字体去除石家庄seo网络优化的公司
  • 大庆做网站最厉害的人营销策划思路
  • 做宣传册参考网站如何做网络推广赚钱