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

集团公司网站开发方案阳江58同城网招聘最新招聘

集团公司网站开发方案,阳江58同城网招聘最新招聘,网站建设流程王晴儿,网页源代码提取文件RANSAC原理:略。 其他博客大多都是介绍拟合单条直线或平面的代码案例,本文介绍如何拟合多条直线或平面,其实是在单个拟合的基础上接着拟合,以此类推。 注意:步骤中的直线模型是每次随机在点云中取点计算的。 步骤&…

RANSAC原理:略。
其他博客大多都是介绍拟合单条直线或平面的代码案例,本文介绍如何拟合多条直线或平面,其实是在单个拟合的基础上接着拟合,以此类推。
注意:步骤中的直线模型是每次随机在点云中取点计算的。
步骤:
1.根据所设参数(点到直线模型的最大距离)把点云分为了内点和外点,对内点进行直线拟合,得到第一次拟合的直线;
2.提取上一步的外点,按照步骤1再次进行内点和外点的划分,对内点拟合直线,得到第二次拟合的直线,并将直线点云叠加到步骤1得到的直线点云中;
3.设置循环终止的条件,重复步骤1-2,最终拟合出点云中所有直线。
多平面拟合的思想如出一辙,概不赘述。

1.RANSAC拟合点云所有直线

//RANSAC拟合多条直线
pcl::PointCloud<pcl::PointXYZ>::Ptr LineFitting(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud) {//内点点云合并pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_lines(new pcl::PointCloud<pcl::PointXYZ>());while (cloud->size() > 20)//循环条件{pcl::SampleConsensusModelLine<pcl::PointXYZ>::Ptr model_line(new pcl::SampleConsensusModelLine<pcl::PointXYZ>(cloud));pcl::RandomSampleConsensus<pcl::PointXYZ> ransac(model_line);ransac.setDistanceThreshold(0.05);	//内点到模型的最大距离ransac.setMaxIterations(100);		//最大迭代次数ransac.computeModel();				//直线拟合//根据索引提取内点std::vector<int> inliers;ransac.getInliers(inliers);pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_line(new pcl::PointCloud<pcl::PointXYZ>());pcl::copyPointCloud<pcl::PointXYZ>(*cloud, inliers, *cloud_line);//若内点尺寸过小,不用继续拟合,跳出循环if (cloud_line->width * cloud_line->height < 20) {break;}*cloud_lines = *cloud_lines + *cloud_line;//pcl::io::savePCDFile(path1+ strcount +"_"+ str + ".pcd", *cloud_line);//提取外点pcl::PointCloud<pcl::PointXYZ>::Ptr outliers(new pcl::PointCloud<pcl::PointXYZ>);pcl::PointIndices::Ptr inliersPtr(new pcl::PointIndices);inliersPtr->indices = inliers;pcl::ExtractIndices<pcl::PointXYZ> extract;extract.setInputCloud(cloud);extract.setIndices(inliersPtr);extract.setNegative(true);  // 设置为true表示提取外点extract.filter(*outliers);//pcl::io::savePCDFile("C:/pclpoint/data/cp1_lineout"+str+".pcd", *outliers);//cout << outliers->size() << endl;cloud->clear();*cloud = *outliers;}return cloud_lines;
}

2.RANSAC拟合点云所有平面

pcl::PointCloud<pcl::PointXYZ>::Ptr planeFitting(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud) {//内点点云合并pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_planes(new pcl::PointCloud<pcl::PointXYZ>());while (cloud->size() > 100)//循环条件{//--------------------------RANSAC拟合平面--------------------------pcl::SampleConsensusModelPlane<pcl::PointXYZ>::Ptr model_plane(new pcl::SampleConsensusModelPlane<pcl::PointXYZ>(cloud));pcl::RandomSampleConsensus<pcl::PointXYZ> ransac(model_plane);ransac.setDistanceThreshold(0.01);	//设置距离阈值,与平面距离小于0.1的点作为内点//ransac.setMaxIterations(100);		//最大迭代次数ransac.computeModel();				//执行模型估计//-------------------------根据索引提取内点--------------------------pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_plane(new pcl::PointCloud<pcl::PointXYZ>);std::vector<int> inplanes;				//存储内点索引的容器ransac.getInliers(inplanes);			//提取内点索引pcl::copyPointCloud<pcl::PointXYZ>(*cloud, inplanes, *cloud_plane);//若内点尺寸过小,不用继续拟合,跳出循环if (cloud_plane->width * cloud_plane->height < 100) {break;}*cloud_planes = *cloud_planes + *cloud_plane;//提取外点pcl::PointCloud<pcl::PointXYZ>::Ptr outplanes(new pcl::PointCloud<pcl::PointXYZ>);pcl::PointIndices::Ptr inplanePtr(new pcl::PointIndices);inplanePtr->indices = inplanes;pcl::ExtractIndices<pcl::PointXYZ> extract;extract.setInputCloud(cloud);extract.setIndices(inplanePtr);extract.setNegative(true);  // 设置为true表示提取外点extract.filter(*outplanes);//pcl::io::savePCDFile("C:/pclpoint/data/cp1_lineout"+str+".pcd", *outliers);//cout << outliers->size() << endl;cloud->clear();*cloud = *outplanes;}//----------------------------输出模型参数---------------------------/*   Eigen::VectorXf coefficient;ransac.getModelCoefficients(coefficient);cout << "平面方程为:\n" << coefficient[0] << "x + " << coefficient[1] << "y + " << coefficient[2] << "z + "<< coefficient[3] << " = 0" << endl;*///返回最终的拟合结果点云return cloud_planes;
}
http://www.yayakq.cn/news/954427/

相关文章:

  • 宁波网站快速优化做网站需要什么域名
  • 建设工程八大员考试网站简洁大气的网站设计
  • 新闻门户网站什么意思爱空间装修公司口碑怎么样
  • 建设申请网站贴吧广告投放
  • 关于优化网站建设的方案商品详情页模板图片
  • 淘宝做网站的店lynda wordpress
  • 关于做我女朋友的网站网页制作与网站建设广州
  • 张家港外贸型网站建设画册排版设计
  • 工程网站模板wordpress搭建外贸网站
  • 西安企业网站建设公司网站建设门店牌子
  • 建筑培训网站有哪些中国住房和城乡建设部
  • 高端旅游的网站建设黄石港区建设局网站
  • 网站积分解决方案使用wordpress rss
  • 无锡快速建设网站方法手机优化大师怎么退款
  • 塑胶卡板东莞网站建设支持东莞五镇只进不出
  • crm系统 网站建设海洋馆网站建设
  • 免费建立个人视频网站公司做网站推广要注意什么
  • 英文网站建设方案 ppt模板edge网页视频怎么下载
  • 有什么类似凡科建站浙江省建设信息港网
  • 网站源码做exe执行程序玉溪市规划建设局网站
  • 自己建设网站需要审核吗wordpress多语模板
  • 专业群建设专题网站工业设计是干什么的
  • 积玉桥网站建设网站怎么做才有百度权重
  • 西安域名注册网站建设青岛仿站定制模板建站
  • 做网站带来的好处北京网站开发一般多少钱
  • 网站外链数怎么查有哪些做网站的网站
  • 塑胶卡板东莞网站建设支持搭建网站需要学什么软件
  • 网站建设费无形资产摊销企业宣传册设计与制作
  • 网站下载软件企业是如何做电子商务网站
  • 顺德高端网站自己做网站赚佣金