[CC]Plugin-提取ISS3D关键点

基于CloudCompare开发的提取ISS3D关键点。

  1 void qLxPluginPCL::doISS3D()
  2 {
  3     assert(m_app);
  4     if (!m_app)
  5         return;
  6
  7     const ccHObject::Container& selectedEntities = m_app->getSelectedEntities();
  8     size_t selNum = selectedEntities.size();
  9     if (selNum!=1)
 10     {
 11         m_app->dispToConsole("Select only one cloud!",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
 12         return;
 13     }
 14
 15     ccHObject* ent = selectedEntities[0];
 16     assert(ent);
 17     if (!ent || !ent->isA(CC_TYPES::POINT_CLOUD))
 18     {
 19         m_app->dispToConsole("Select a real point cloud!",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
 20         return;
 21     }
 22
 23     ccPointCloud* m_cc_cloud = static_cast<ccPointCloud*>(ent);
 24
 25
 26     //input cloud
 27     unsigned count = m_cc_cloud->size();
 28     bool hasNorms = m_cc_cloud->hasNormals();
 29     CCVector3 bbMin, bbMax;
 30     m_cc_cloud->getBoundingBox(bbMin,bbMax);
 31     const CCVector3d& globalShift = m_cc_cloud->getGlobalShift();
 32     double globalScale = m_cc_cloud->getGlobalScale();
 33
 34     ccIss3Ddlg dlg;
 35     if (!dlg.exec())
 36         return;
 37
 38     double s_SalientRadius=dlg.sbSalientRadius->value();
 39     double s_NonMaxRadius =dlg.spNonMaxRadius->value();
 40     double s_Threshold21 = dlg.spThreshold21->value();
 41     double s_Threshold32 = dlg.spThreshold32->value();
 42
 43     pcl::PointCloud<PointXYZ>::Ptr pcl_cloud (new pcl::PointCloud<PointXYZ>);
 44     try
 45     {
 46         unsigned pointCount = m_cc_cloud->size();
 47         pcl_cloud->resize(pointCount);
 48
 49         for (unsigned i = 0; i < pointCount; ++i)
 50         {
 51             const CCVector3* P = m_cc_cloud->getPoint(i);
 52             pcl_cloud->at(i).x = static_cast<float>(P->x);
 53             pcl_cloud->at(i).y = static_cast<float>(P->y);
 54             pcl_cloud->at(i).z = static_cast<float>(P->z);
 55         }
 56     }
 57     catch(...)
 58     {
 59         //any error (memory, etc.)
 60         pcl_cloud.reset();
 61     }
 62
 63     printf("读取了data点云数据:%d\n",pcl_cloud->size());
 64
 65     pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ());
 66
 67     pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_out (new pcl::PointCloud<pcl::PointXYZ>);
 68
 69     pcl::ISSKeypoint3D<pcl::PointXYZ,pcl::PointXYZ> iss_detector;
 70     iss_detector.setSearchMethod (tree);
 71     iss_detector.setSalientRadius(s_SalientRadius);
 72     iss_detector.setNonMaxRadius(s_NonMaxRadius);
 73     /*iss_detector.setSalientRadius(2.0f);
 74     iss_detector.setNonMaxRadius(1.6f);*/
 75     iss_detector.setInputCloud(pcl_cloud);
 76     /*iss_detector.setThreshold21 (0.975);
 77     iss_detector.setThreshold32 (0.975);*/
 78     iss_detector.setThreshold21 (s_Threshold21);
 79     iss_detector.setThreshold32 (s_Threshold32);
 80     iss_detector.setMinNeighbors (5);
 81     iss_detector.setNumberOfThreads (4);
 82     cout<<"parameter set successful"<<endl;
 83     iss_detector.compute(*cloud_out);
 84
 85     int pointCount = cloud_out->size();
 86
 87     //static_cast<size_t>(sm_cloud ? sm_cloud->width * sm_cloud->height : 0);
 88
 89     ccPointCloud* ccCloud =new ccPointCloud();
 90     if (!ccCloud->reserve(static_cast<unsigned>(pointCount)))
 91         return ;
 92     for (size_t i = 0; i < pointCount; ++i)
 93     {
 94         CCVector3 P(cloud_out->at(i).x,cloud_out->at(i).y,cloud_out->at(i).z);
 95         ccCloud->addPoint(P);
 96     }
 97     ccCloud->setName(QString("ISS3D"));
 98     ccColor::Rgb col = ccColor::Generator::Random();
 99     ccCloud->setRGBColor(col);
100     ccCloud->showColors(true);
101     ccCloud->setPointSize(5);
102     ccHObject* group = 0;
103     if (!group)
104         group = new ccHObject(QString("ISS3D").arg(ent->getName()));
105     group->addChild(ccCloud);
106     group->setVisible(true);
107     m_app->addToDB(group);
108 }

界面:

时间: 2024-08-02 07:56:39

[CC]Plugin-提取ISS3D关键点的相关文章

OpenCV入门 - 提取SIFT关键点

在基于内容的图像检索中,图像的局部不变特征是相对全局特征来说的,局部特征可以有力的描述图像的特征,具有重要的意义,而在很多基于灰度的局部特征提取算法中SIFT具有最好的效果,具体原理要看Lowe的论文,下面利用opencv感受以下效果. #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/nonfree/features2d.hpp> // u

从cocos2d-html5中提取出来的,用做前端开发的框架——cc.js

从cocos2d-html5中提取出来的,用做前端开发的框架——cc.js /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011 Zynga Inc. http://www.cocos2d-x.org P

Opencv 各种特征点提取和匹配

opencv 特征点的提取和匹配 1. 当中的数据结构 KeyPoint这数据结构中有如下数据结构: class KeyPoint { Point2f pt; //坐标 float size; //特征点邻域直径 float angle; //特征点的方向,值为[零,三百六十),负值表示不使用 float response; int octave; //特征点所在的图像金字塔的组 int class_id; //用于聚类的id angle:角度,表示关键点的方向,SIFT算法通过对关键点周围邻域

(一)ORB描述子提取

ORBSLAM2中使用ORB描述子的方法 经典的视觉SLAM系统大体分为两种:其一是基于特征点法的,其二是基于直接法的.那么本文主要就讲特征点法的SLAM. 基于特征点法的视觉SLAM系统典型的有PTAM,ORBSLAM等.本文主要围绕ORBSLAM2的方案来阐述特征点法SLAM,因为ORBSLAM2可以说是特征点法SLAM的巅峰之作.ORBSLAM2采用三个主要线程:跟踪,局部建图和闭环以及一个额外线程:全局BA,该线程只有在闭环时才会触发.值得注意的是,ORBSLAM2中每个模块中都采用OR

图像特征的提取

1.  HOG特征 方向梯度直方图(Histogram of Oriented Gradient, HOG)特征是一种在计算机视觉和图像处理中用来进行物体检测的特征描述子.它通过计算和统计图像局部区域的梯度方向直方图来构成特征.Hog特征结合SVM分类器已经被广泛应用于图像识别中,尤其在行人检测中获得了极大的成功. 主要思想:--获取轮廓信息 在一副图像中,局部目标的表象和形状(appearance and shape)能够被梯度或边缘的方向密度分布很好地描述.(本质:梯度的统计信息,而梯度主要

一个简单的inno setup模板

一.模板代码 基本功能包括多路径安装.多语言.自定义图标. [Setup] ShowLanguageDialog=yes AppCopyright=Copyright Reserved(C) 2016, 360 Inc. AppName={cm:Packagename} AppVerName={cm:Packagename} {cm:Packagever} LicenseFile= OutputDir=C:/installer UninstallFilesDir={code:getdlldir}

直接法

前言 直接法是视觉里程计另一主要分支,它与特征点法有很大不同.随着SVO.LSD-SLAM等直接法SLAM方案的流行,直接法本身也得到越来越多的关注.特征点法与直接究竟谁更好一些,是近年视觉里程计研究领域一个非常有趣的问题.本讲,我们将介绍直接法的原理,并利用g2o实现基于直接法的视觉里程计. 1. 直接法的引出 尽管特征点法在视觉里程计中占据主流地位,研究者们认识它至少有以下几个缺点: 关键点的提取与描述子的计算非常耗时.实践当中,SIFT目前在CPU上是无法实时计算的,而ORB也需要近20毫

【Discuz插件】视频专题 2.2.6 支持手机版、门户和一键视频采集功能,搭建在线视频网站

视频专题 2.2.6 Discuz视频插件是我个人用过的最好用的Discuz插件,在所有的做视频网址的Discuz插件当中,视频专题 2.2.6 Discuz视频插件是最人性化,最简单易用,最稳定的一个插件.不信的话,你尽管去找各种各样的视频插件,你用过之后,再来对比,保证你感叹事实如此!我找过用过的discuz视频插件,也不少了,简单好用的就是这个视频专题 2.2.6了!因此,做discuz的大神们,绝对不要错过这样一个好插件!!!! 真心感受,罗列一下: 就是优酷土豆这种视频播放网站的界面,

程序员这样优化简历,一投制胜

本文转载于: (http://mp.weixin.qq.com/s?__biz=MzAxMzUzNzYyNA==&mid=402350606&idx=1&sn=c356b88f22d9277534aeee773f07d6ca&scene=23&srcid=02256Zn4PnYzdQ8M8WyTj5BG#rd&ADUIN=3024665621&ADSESSION=1456446961&ADTAG=CLIENT.QQ.5467_.0&A