资源简介
完成的功能有:三维点云获取,点云数据下采样(为后续处理加速),平面检测和获取,3D显示
在一个老外牛人的程序上改的,原版只支持点云获取和显示,不包括点云处理。另外,原版有个bug,会导致大量的CPU时间用来显示无效的点云数据,已被我这版修正。
程序中有个宏开关CLOUD_DISPLAY,如果定义这个宏则有三维显示,如果不定义这个宏则关闭三维显示功能。关闭三维显示的目的是为了加速三维点云数据的处理。
另外,使用本程序必要条件是要在你电脑上把Kinect SDK装好,这个去官网下就是了。同时需要把PCL环境配好,推荐另外一个牛人的博客:http://www.zhangzscn.com/2016/03/02/pcl1-8-0%EF%BC%8Cvs2013%E9%85%8D%E7%BD%AE%E6%95%99%E7%A8%8B%E3%80%82/

代码片段和文件信息
// Disable Error C4996 that occur when using Boost.Signals2.
#ifdef _DEBUG
#define _SCL_SECURE_NO_WARNINGS
#endif
#include “kinect2_grabber.h“
#include
#include
// RANSAC
#include
#include
#include
#include
#include
#include
#define CLOUD_DISPLAY
typedef pcl::PointXYZRGBA PointType;
//typedef pcl::PointXYZ PointType;
int produced_frame_count_last = 0 produced_frame_count_current = 0;
int main( int argc char* argv[] )
{
#ifdef CLOUD_DISPLAY
// PCL Visualizer
boost::shared_ptr viewer(
new pcl::visualization::PCLVisualizer( “Point Cloud Viewer“ ) );
viewer->setCameraPosition( 0.0 0.0 -2.5 0.0 0.0 0.0 );
#endif
// Point Cloud
pcl::PointCloud::ConstPtr cloud;
//RANSAC
pcl::PointCloud::Ptr final(new pcl::PointCloud);
bool is_plane = true;
if (pcl::console::find_argument(argc argv “-f“) >= 0)
{
is_plane = true;
}
else if (pcl::console::find_argument(argc argv “-sf“) >= 0)
{
is_plane = false;
}
std::vector inliers;
// Retrieved Point Cloud Callback Function
boost::mutex mutex;
boost::function::ConstPtr& )> function =
[&cloud &mutex &is_plane &final]( const pcl::PointCloud::ConstPtr& ptr ){
boost::mutex::scoped_lock lock( mutex );
cloud = ptr;
produced_frame_count_current++;
};
// Kinect2Grabber
boost::shared_ptr grabber = boost::make_shared();
// Register Callback Function
boost::signals2::connection connection = grabber->registerCallback( function );
// Start Grabber
grabber->start();
DWORD tick_start tick_end;
int handled_frame_count_last = 0 handled_frame_count_current = 0 frame_count_before = 0;
tick_start = GetTickCount();
#ifdef CLOUD_DISPLAY
while( !viewer->wasStopped() ){
// Update Viewer
viewer->spinOnce();
#else
Sleep(100);
while (1) {
#endif
if (produced_frame_count_current == produced_frame_count_last) {
Sleep(1);
continue;
}
produced_frame_count_last = produced_frame_count_current;
boost::mutex::scoped_try_lock lock( mutex );
if (cloud && lock.owns_lock()){
// handle cloud here
// Create the filtering object: downsample the dataset using a leaf size of 1cm
pcl::PointCloud::Ptr cloud_filtered(new pcl::PointCloud);
pcl::VoxelGrid sor;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 20266 2016-03-06 03:36 KinectGrabber-Kinect2Grabber\kinect2_grabber.h
....... 1100 2016-03-06 03:36 KinectGrabber-Kinect2Grabber\License.txt
....... 1358 2016-03-06 03:36 KinectGrabber-Kinect2Grabber\README.md
文件 91483 2016-04-26 10:22 KinectGrabber-Kinect2Grabber\Sample\bin\ALL_BUILD.vcxproj
文件 325 2016-04-26 10:22 KinectGrabber-Kinect2Grabber\Sample\bin\ALL_BUILD.vcxproj.filters
文件 50806 2016-04-26 10:22 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeCache.txt
文件 1954 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CMakeCCompiler.cmake
文件 2751 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CMakeCXXCompiler.cmake
文件 36864 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CMakeDetermineCompilerABI_C.bin
文件 36864 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CMakeDetermineCompilerABI_CXX.bin
文件 212 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CMakeRCCompiler.cmake
文件 395 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CMakeSystem.cmake
文件 16967 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdC\CMakeCCompilerId.c
文件 10240 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdC\CompilerIdC.exe
文件 2403 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdC\CompilerIdC.vcxproj
文件 2023 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdC\Debug\CMakeCCompilerId.obj
文件 776 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdC\Debug\CompilerIdC.tlog\cl.command.1.tlog
文件 582 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdC\Debug\CompilerIdC.tlog\CL.read.1.tlog
文件 516 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdC\Debug\CompilerIdC.tlog\CL.write.1.tlog
文件 235 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdC\Debug\CompilerIdC.tlog\CompilerIdC.lastbuildstate
文件 1090 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdC\Debug\CompilerIdC.tlog\li
文件 2984 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdC\Debug\CompilerIdC.tlog\li
文件 510 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdC\Debug\CompilerIdC.tlog\li
文件 16939 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdCXX\CMakeCXXCompilerId.cpp
文件 10752 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdCXX\CompilerIdCXX.exe
文件 2411 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdCXX\CompilerIdCXX.vcxproj
文件 2036 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdCXX\Debug\CMakeCXXCompilerId.obj
文件 800 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdCXX\Debug\CompilerIdCXX.tlog\cl.command.1.tlog
文件 594 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdCXX\Debug\CompilerIdCXX.tlog\CL.read.1.tlog
文件 536 2016-04-26 10:21 KinectGrabber-Kinect2Grabber\Sample\bin\CMakeFiles\3.5.1\CompilerIdCXX\Debug\CompilerIdCXX.tlog\CL.write.1.tlog
............此处省略56个文件信息
- 上一篇:串口通信编程大全.pdf
- 下一篇:chrome史上最完整调用ocx完整解决方案
相关资源
- 汉印A300 CPCL协议 android 热敏打印app(
- 超级场景清理器(SPCleaner)v1.0免费版
- httpclient4.3工具类
- 一种机载LiDAR和车载LiDAR点云的自动配
- Kinect手势代替鼠标控制PC
- SfM稀疏三维点云重建--完整工程文件
- 全面的点云库PCL学习教程
- 彩色图片和深度图片生成点云文件
- ICP+NDT点云配准
- CPCL查看器.rar
- 1种新的散乱点云快速去噪算法
- Linux ntpclient代码
- 点云库PCL学习教程 完整版
- .las格式点云文件
- 使用OpenNI自带的类进行简单手势识别
- icp三维点云配准文件
- 中英文PCL5语言参考手册_11086676.zip
- 基于Kinect的三维重建
- 地形点云.pcd
- stm32f4+w5500+tcpclient/server源码
- PC-lint 9 + 中文手册
- openGL实现三维点云显示
- GA+ICP代码
- 建筑物的地面扫描点云数据
- FTPclinet客户端
- 点云拼接和拟合算法
- 点云TXT转换PCD
- PCL点云库SACSegmentation用法demo
- 小兔子pcd点云数据pcl官方案例1)
- 八叉树点云精简
评论
共有 条评论