这篇博文主要介绍SIFT算法在提取点云图像关键点时的具体用法。

尺度不变特征转换(Scale-invariant feature transform,SIFT)是David Lowe在1999年发表,2004年总结完善。其应用范围包括物体辨识,机器人地图感知与导航、3D模型建立、手势辨识、影像追踪和动作对比。此算法已经申请专利,专利拥有者属于英属哥伦比亚大学。SIFT算法在3D数据上的应用由Flint等在2007年实现。这里所讲的提取点云关键点的算法便是由Flint等人实现的SIFT3D算法。

其实现代如下:

 // STL
#include <iostream> // PCL
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/common/io.h>
#include <pcl/keypoints/sift_keypoint.h>
#include <pcl/features/normal_3d.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/console/time.h> /* This examples shows how to estimate the SIFT points based on the
* z gradient of the 3D points than using the Intensity gradient as
* usually used for SIFT keypoint estimation.
*/ namespace pcl
{
template<>
struct SIFTKeypointFieldSelector<PointXYZ>
{
inline float
operator () (const PointXYZ &p) const
{
return p.z;
}
};
} int
main(int, char** argv)
{
std::string filename = argv[];
std::cout << "Reading " << filename << std::endl;
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_xyz (new pcl::PointCloud<pcl::PointXYZ>);
if(pcl::io::loadPCDFile<pcl::PointXYZ> (filename, *cloud_xyz) == -) // load the file
{
PCL_ERROR ("Couldn't read file");
return -;
}
std::cout << "points: " << cloud_xyz->points.size () <<std::endl; // Parameters for sift computation
const float min_scale = 0.005f; //the standard deviation of the smallest scale in the scale space
const int n_octaves = ;//the number of octaves (i.e. doublings of scale) to compute
const int n_scales_per_octave = ;//the number of scales to compute within each octave
const float min_contrast = 0.005f;//the minimum contrast required for detection pcl::console::TicToc time;
time.tic();
// Estimate the sift interest points using z values from xyz as the Intensity variants
pcl::SIFTKeypoint<pcl::PointXYZ, pcl::PointWithScale> sift;
pcl::PointCloud<pcl::PointWithScale> result;
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZ> ());
sift.setSearchMethod(tree);
sift.setScales(min_scale, n_octaves, n_scales_per_octave);
sift.setMinimumContrast(min_contrast);
sift.setInputCloud(cloud_xyz);
sift.compute(result);
std::cout<<"Computing the SIFT points takes "<<time.toc()/<<"seconds"<<std::endl;
std::cout << "No of SIFT points in the result are " << result.points.size () << std::endl; // Copying the pointwithscale to pointxyz so as visualize the cloud
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_temp (new pcl::PointCloud<pcl::PointXYZ>);
copyPointCloud(result, *cloud_temp);
std::cout << "SIFT points in the result are " << cloud_temp->points.size () << std::endl;
// Visualization of keypoints along with the original cloud
pcl::visualization::PCLVisualizer viewer("PCL Viewer");
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> keypoints_color_handler (cloud_temp, , , );
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> cloud_color_handler (cloud_xyz, , , );
viewer.setBackgroundColor( 0.0, 0.0, 0.0 );
viewer.addPointCloud(cloud_xyz, cloud_color_handler, "cloud");//add point cloud
viewer.addPointCloud(cloud_temp, keypoints_color_handler, "keypoints");//add the keypoints
viewer.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, , "keypoints"); while(!viewer.wasStopped ())
{
viewer.spinOnce ();
} return ; }

运行结果如下图所示:

基于SIFT的点云关键点提取的更多相关文章

  1. 基于SIFT+Kmeans+LDA的图片分类器的实现

    原地址:http://www.cnblogs.com/freedomshe/archive/2012/04/24/2468747.html 题记:2012年4月1日回到家,南大计算机研究僧复试以后,等 ...

  2. 基于SIFT特征的全景图像拼接

    基于SIFT特征的全景图像拼接 分类: image Machine learning2013-07-05 13:33 2554人阅读 评论(3) 收藏 举报 基于SIFT特征的全景图像拼接 分类: 计 ...

  3. 机器学习进阶-图像特征sift-SIFT特征点 1.cv2.xfeatures2d.SIFT_create(实例化sift) 2. sift.detect(找出关键点) 3.cv2.drawKeypoints(画出关键点) 4.sift.compute(根据关键点计算sift向量)

    1. sift = cv2.xfeatures2d.SIFT_create() 实例化 参数说明:sift为实例化的sift函数 2. kp = sift.detect(gray, None)  找出 ...

  4. IBM基于Kubernetes的容器云全解析

    基于Kubernetes的容器云 容器云最主要的功能是以应用为中心,帮助用户把所有的应用以容器的形式在分布式里面跑起来,最后把应用以服务的形式呈现给用户.容器云里有两个关键点,一是容器编排,二是资源调 ...

  5. 29 基于PCL的点云平面分割拟合算法技术路线(针对有噪声的点云数据)

    0 引言 最近项目中用到了基于PCL开发的基于平面的点云和CAD模型的配准算法,点云平面提取采用的算法如下. 1 基于PCL的点云平面分割拟合算法 2 参数及其意义介绍 (1)点云下采样 1. 参数: ...

  6. 基于 Angularjs&Node.js 云编辑器架构设计及开发实践

    基于 Angularjs&Node.js 云编辑器架构设计及开发实践 一.产品背景 二.总体架构 1. 前端架构 a.前端层次 b.核心基础模块设计 c.业务模块设计 2. Node.js端设 ...

  7. 基于VPN搭建混合云架构需要考虑的网络因素

     Joy Qiao from MSFT Wed, Jan 21 2015 8:44 AM 很多用户在搭建混合云架构时,会使用到微软Azure虚拟网络中的 VPN功能,来实现Azure中的虚拟网络与用户 ...

  8. 基于AngularJS的前端云组件最佳实践

    AngularJS是google设计和开发的一套前端开发框架,他能帮助开发人员更便捷地进行前端开发.AngularJS是为了克服HTML在构建应用上的不足而设计的,它非常全面且简单易学习,因此Angu ...

  9. 基于Hadoop开发网络云盘系统客户端界面设计初稿

    基于Hadoop开发网络云盘系统客户端界面设计初稿 前言: 本文是<基于Hadoop开发网络云盘系统架构设计方案>的第二篇,针对界面原型原本考虑有两个方案:1.类windows模式,文件夹 ...

随机推荐

  1. 【BZOJ 1083】 [SCOI2005]繁忙的都市

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 很明显的最小生成树了. 输出最后选的那条边就好了. [代码] #include <bits/stdc++.h> usin ...

  2. G4Studio+extjs+highcharts 下在ext4j的panel中放入hightCharts图表

    在G4Studio+extjs下.创建一个panel,然后将highCharts图表放入panel中.实现方法例如以下: 首先简单给出的部分代码: Ext.onReady(function() { v ...

  3. SQL 字符串操作函数

    SQL 字符串操作函数 学习了: https://www.cnblogs.com/wangzhe688/p/6046654.html 一.字符转换函数 1.ASCII() 返回字符表达式最左端字符的A ...

  4. 工作笔记5.JAVA图片验证码

    本文主要内容为:利用JAVA图片制作验证码. 设计思路: 1.拷贝AuthImageServlet.class图片验证码 2.配置web.xml 3.JSP中,调用封装好的AuthImageServl ...

  5. 走进windows编程的世界-----消息处理函数(2)

    一 WM_PAINT消息 1 WM_PAINT的产生   因为窗体的互相覆盖等,产生须要绘制的区域,那么会产生WM_PAINT消息.   普通情况下,不直接发送WM_PAINT消息,通过API声明须要 ...

  6. 手动配置三大框架整合:Spring+Struts2+mybatis

    如今主流的项目框架中,数据库持久层有可能不是hibernate,而是mybatis或者ibatis,事实上它们都是一样的,以下我来把环境搭建一下: [导入相关jar包]新建web项目projectms ...

  7. zookeeper的理解与概述

    文章转自https://www.cnblogs.com/likehua/p/3999600.html  感谢博主 文章转自:http://www.aboutyun.com/thread-9266-1- ...

  8. Android-加载大图避免OOM

    高效加载大图片 我们在编写Android程序的时候经常要用到许多图片,不同图片总是会有不同的形状.不同的大小,但在大多数情况下,这些图片都会大于我们程序所需要的大小.比如说系统图片库里展示的图片大都是 ...

  9. spinlock参考资料

    spinlock:http://irl.cs.ucla.edu/~yingdi/web/paperreading/smp_locking.pdf

  10. js对浏览器产生的影响

     Js 是单线程执行引擎.在我们动态修改一些属性时会产生两种效果:    1.Repaint ----- 一部分重画,修改 div 的颜色呀,但是尺寸没有改变.    2.Reflow ---- 元素 ...