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

免费ppt模板下载大全网站空间设计英文

免费ppt模板下载大全网站,空间设计英文,网站建设 app开发 小程序,做网站用矢量图还是位图介绍 条件欧氏聚类分割是一种基于欧氏距离和条件限制的点云分割方法。它通过计算点云中点与点之间的欧氏距离,并结合一定的条件限制来将点云分割成不同的区域或聚类。 在条件欧氏聚类分割中,通常会定义以下两个条件来判断两个点是否属于同一个聚类&…

介绍

条件欧氏聚类分割是一种基于欧氏距离和条件限制的点云分割方法。它通过计算点云中点与点之间的欧氏距离,并结合一定的条件限制来将点云分割成不同的区域或聚类。

在条件欧氏聚类分割中,通常会定义以下两个条件来判断两个点是否属于同一个聚类:

  1. 距离条件:两个点之间的欧氏距离是否小于设定的阈值。如果两个点之间的距离小于阈值,则认为它们是相邻的,属于同一个聚类。

  2. 条件限制:除了距离条件外,还可以根据其他的条件来限制聚类的形成。例如,可以限制点的法线方向、颜色、强度等属性的相似性,只有当这些属性满足一定的条件时,两个点才被认为是相邻的,属于同一个聚类。

条件欧氏聚类分割的步骤通常包括以下几个步骤:

  1. 初始化:设置距离阈值和其他条件限制的参数。

  2. 遍历点云:对于点云中的每个点,依次进行以下操作:

    • 计算当前点与其周围点之间的欧氏距离。

    • 根据距离条件和其他条件限制,判断当前点是否与周围点属于同一个聚类。如果是,则将它们标记为同一个聚类。

    • 继续遍历其他未被标记的点,重复上述操作,直到所有点都被遍历完。

  3. 输出聚类结果:将同一个聚类的点标记为一组,形成不同的聚类簇。

效果

代码

#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl/console/time.h>#include <pcl/filters/voxel_grid.h>
#include <pcl/features/normal_3d.h>
#include <pcl/segmentation/conditional_euclidean_clustering.h>typedef pcl::PointXYZI PointTypeIO;
typedef pcl::PointXYZINormal PointTypeFull;bool enforceIntensitySimilarity (const PointTypeFull& point_a, const PointTypeFull& point_b, float /*squared_distance*/){if (std::abs (point_a.intensity - point_b.intensity) < 5.0f)return (true);elsereturn (false);}bool enforceNormalOrIntensitySimilarity (const PointTypeFull& point_a, const PointTypeFull& point_b, float /*squared_distance*/)
{// 将点云的法线信息转换未Eigen库的Eigen:vector3f类型Eigen::Map<const Eigen::Vector3f> point_a_normal = point_a.getNormalVector3fMap (), point_b_normal = point_b.getNormalVector3fMap ();// 判断点云A的点云B的强度差是否小于5.0if (std::abs (point_a.intensity - point_b.intensity) < 5.0f)return (true);// 判断点云A和点云B的法线夹角的余弦值是否大于30°对应的余弦值,即判断法线相似性if (std::abs (point_a_normal.dot (point_b_normal)) > std::cos (30.0f / 180.0f * static_cast<float> (M_PI)))return (true);return (false);
}bool customRegionGrowing (const PointTypeFull& point_a, const PointTypeFull& point_b, float squared_distance)
{Eigen::Map<const Eigen::Vector3f> point_a_normal = point_a.getNormalVector3fMap (), point_b_normal = point_b.getNormalVector3fMap ();// 根据平方距离的大小,判断生长条件if (squared_distance < 10000){if (std::abs (point_a.intensity - point_b.intensity) < 8.0f)return (true);if (std::abs (point_a_normal.dot (point_b_normal)) > std::cos (30.0f / 180.0f * static_cast<float> (M_PI)))return (true);}else{if (std::abs (point_a.intensity - point_b.intensity) < 3.0f)return (true);}return (false);
}int main ()
{// Data containers usedpcl::PointCloud<PointTypeIO>::Ptr cloud_in (new pcl::PointCloud<PointTypeIO>), cloud_out (new pcl::PointCloud<PointTypeIO>);pcl::PointCloud<PointTypeFull>::Ptr cloud_with_normals (new pcl::PointCloud<PointTypeFull>);pcl::IndicesClustersPtr clusters (new pcl::IndicesClusters), small_clusters (new pcl::IndicesClusters), large_clusters (new pcl::IndicesClusters);pcl::search::KdTree<PointTypeIO>::Ptr search_tree (new pcl::search::KdTree<PointTypeIO>);pcl::console::TicToc tt;// Load the input point cloudstd::cerr << "Loading...\n", tt.tic ();pcl::io::loadPCDFile ("Statues_4.pcd", *cloud_in);std::cerr << ">> Done: " << tt.toc () << " ms, " << cloud_in->size () << " points\n";// Downsample the cloud using a Voxel Grid classstd::cerr << "Downsampling...\n", tt.tic ();pcl::VoxelGrid<PointTypeIO> vg;vg.setInputCloud (cloud_in);vg.setLeafSize (80.0, 80.0, 80.0);vg.setDownsampleAllData (true);vg.filter (*cloud_out);std::cerr << ">> Done: " << tt.toc () << " ms, " << cloud_out->size () << " points\n";// Set up a Normal Estimation class and merge data in cloud_with_normalsstd::cerr << "Computing normals...\n", tt.tic ();pcl::copyPointCloud (*cloud_out, *cloud_with_normals);pcl::NormalEstimation<PointTypeIO, PointTypeFull> ne;ne.setInputCloud (cloud_out);ne.setSearchMethod (search_tree);ne.setRadiusSearch (300.0);ne.compute (*cloud_with_normals);std::cerr << ">> Done: " << tt.toc () << " ms\n";// Set up a Conditional Euclidean Clustering classstd::cerr << "Segmenting to clusters...\n", tt.tic ();pcl::ConditionalEuclideanClustering<PointTypeFull> cec (true);cec.setInputCloud (cloud_with_normals);cec.setConditionFunction (&customRegionGrowing);cec.setClusterTolerance (500.0);cec.setMinClusterSize (cloud_with_normals->size () / 1000);cec.setMaxClusterSize (cloud_with_normals->size () / 5);cec.segment (*clusters);cec.getRemovedClusters (small_clusters, large_clusters);std::cerr << ">> Done: " << tt.toc () << " ms\n";// Using the intensity channel for lazy visualization of the outputfor (const auto& small_cluster : (*small_clusters))for (const auto& j : small_cluster.indices)(*cloud_out)[j].intensity = -2.0;for (const auto& large_cluster : (*large_clusters))for (const auto& j : large_cluster.indices)(*cloud_out)[j].intensity = +10.0;for (const auto& cluster : (*clusters)){int label = rand () % 8;for (const auto& j : cluster.indices)(*cloud_out)[j].intensity = label;}// Save the output point cloudstd::cerr << "Saving...\n", tt.tic ();pcl::io::savePCDFile ("output.pcd", *cloud_out);std::cerr << ">> Done: " << tt.toc () << " ms\n";return (0);
}

http://www.yayakq.cn/news/578983/

相关文章:

  • 招聘网站制作公司超级网站模板下载
  • 邢台推广网站建设电话wordpress 图片暗箱插件
  • 四子王旗建设局网站软件外包公司可以去吗
  • 广东网站建设服务大连做网站哪家好一点
  • 什么叫网站权重宁波建工工程集团有限公司
  • 怎么样做购物网站动漫设计与制作有什么学校
  • 苏州专业做网站公司有哪些c2c模式名词解释
  • 汶上县建设局官方网站网站建设模式有哪些内容
  • 网站开发跟app开发的差别建筑设计主要内容
  • wap网站制作教程全国最大网站建站公司
  • 深圳市工程交易中心网站包头全网营销网站建设
  • 网站备案跟域名备案学习网站建设要什么学历
  • 请将已备案网站接入访问网页微信聊天电脑有记录吗
  • 嘉兴英文网站建设电子商务网站建设 精品课程
  • 怎么建设网站网页游戏国内优秀网站设计
  • 聊城网站建设报价杭州建设网站网站
  • 增加网站和接入备案电子商务网站建设初学视频教程
  • 制作网站用什么语言虚拟主机搭建wordpress
  • 廊坊网站搭建网站制作软件都是什么
  • 深圳网站. 方维网络网页开发流程图
  • 网站模块是什么意思竞价推广怎么做
  • 有没有代做模型的网站公众号兼职网站开发
  • 网站优化排名网站吴忠建设局网站
  • 怎么用lls做网站中山精品网站建设流程
  • 企业建设网站的意义电子政务网站建设方案
  • 如何设计制作网站seo是什么意思 职业
  • 广州网站设计专注乐云seo用asp.net做的 购物网站视频
  • 集团网站建设网络公司网站关键字优化工具
  • 网站项目建设所需成本qq网页版在线直接登录
  • 潍城区建设局网站中国新发展+世界新机遇