资源简介
完成的功能有:三维点云获取,点云数据下采样(为后续处理加速),平面检测和获取,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完整解决方案
相关资源
- kinect 2.0生成点云,并用PCL存储
- 聚类识别源代码
- TcpListener类与TcpClient类的使用
- WebApi系列-通过HttpClient来调用WebApi接口
- 点云数据ply格式
- 点云pcd与txt之间的转换
- 点云生成mesh的算法
- kinect官方技术文档英文
- pcl icp算法
- 基于 ROS 与 Kinect 的移动机器人同时定
- PCL-1.9.1-AllInOne-msvc2017-win64 百度云链接
- source.zip
- 微软KinectFusion开源实现
- 三维点云数据的显示,并可以对三维
- 海量点云数据的重复点删除
- Kinect获取彩色图像并保存为jpg图片
- QTP完全卸载助手纯净-QTPCleanUninstalle
- kinect 2.0获取深度和彩色帧并存为jpg图
- KinectFusion: Real-time 3D Reconstruction论文翻
- 三维点云重构生成网格
- 点云分割基于特征边界提取
- 最新Kinect v2 with MS-SDK 2.10.1 for Unity3D
- 已安装ROS-Kinectic的树莓派ubuntu16的im
- Kinect for unity sdk v2.9.unitypackage
- 三个点云数据
- sensor-win64-5.1.2.1-redist.msi
- Kinect2.0开发文档
- Kinect获取深度图像
- Complex-YOLO
- pointCloud
评论
共有 条评论