资源简介
在vs2013平台下用c++实现的通过Kinect获取场景点云数据并显示的程序。获取线程从Kinect中读取深度数据与图像数据,经坐标映射与融合后生成目标点云数据,通过boost的信号槽机制传输到主线程中并将其使用PCL提供的visualizer在窗口中加以显示。编译运行前需要配置PCL与Kinect2.0SDK两个外部依赖库。整体代码简单,思路清晰,适合刚入门的新手学习。

代码片段和文件信息
#include “PointCloudGrabber.h“
#include
#include
#include
#include
#include
#include
#include
#include
#include
PointCloudGrabber::PointCloudGrabber()
: _sensor(nullptr)
_mapper(nullptr)
_colorSource(nullptr)
_colorReader(nullptr)
_depthSource(nullptr)
_depthReader(nullptr)
_result(S_OK)
_colorWidth(1920)
_colorHeight(1080)
_colorBuffer()
_depthWidth(512)
_depthHeight(424)
_depthPointCount(512 * 424)
_depthBuffer(_depthPointCount)
_colorSpacePoints(512 * 424)
_cameraSpacePoints(512 * 424)
{
}
PointCloudGrabber::~PointCloudGrabber()
{
}
bool PointCloudGrabber::OpenDevice()
{
// Create Sensor Instance
_result = GetDefaultKinectSensor(&_sensor);
if (FAILED(_result)){
throw std::exception(“Exception : GetDefaultKinectSensor()“);
}
// Open Sensor
_result = _sensor->Open();
if (FAILED(_result)){
throw std::exception(“Exception : IKinectSensor::Open()“);
}
// Retrieved Coordinate Mapper
_result = _sensor->get_CoordinateMapper(&_mapper);
if (FAILED(_result)){
throw std::exception(“Exception : IKinectSensor::get_CoordinateMapper()“);
}
// Retrieved Color frame Source
_result = _sensor->get_ColorframeSource(&_colorSource);
if (FAILED(_result)){
throw std::exception(“Exception : IKinectSensor::get_ColorframeSource()“);
}
// Retrieved Depth frame Source
_result = _sensor->get_DepthframeSource(&_depthSource);
if (FAILED(_result)){
throw std::exception(“Exception : IKinectSensor::get_DepthframeSource()“);
}
// Retrieved Color frame Size
iframeDescription* colorDescription;
_result = _colorSource->get_frameDescription(&colorDescription);
if (FAILED(_result)){
throw std::exception(“Exception : IColorframeSource::get_frameDescription()“);
}
_result = colorDescription->get_Width(&_colorWidth); // 1920
if (FAILED(_result)){
throw std::exception(“Exception : iframeDescription::get_Width()“);
}
_result = colorDescription->get_Height(&_colorHeight); // 1080
if (FAILED(_result)){
throw std::exception(“Exception : iframeDescription::get_Height()“);
}
SafeRelease(colorDescription);
// To Reserve Color frame Buffer
_colorBuffer.resize(_colorWidth * _colorHeight);
// Retrieved Depth frame Size
iframeDescription* depthDescription;
_result = _depthSource->get_frameDescription(&depthDescription);
if (FAILED(_result)){
throw std::exception(“Exception : IDepthframeSource::get_frameDescription()“);
}
_result = depthDescription->get_Width(&_depthWidth); // 512
if (FAILED(_result)){
throw std::exception(“Exception : iframeDescription::get_Width()“);
}
_result = depthDescription->get_Height(&_depthHeight); // 424
if (FAILED(_res
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-09-10 09:14 PointCloudScanner\
目录 0 2017-09-10 09:14 PointCloudScanner\PointCloudScanner\
文件 997 2017-09-10 09:13 PointCloudScanner\PointCloudScanner.sln
文件 27136 2017-09-10 09:14 PointCloudScanner\PointCloudScanner.v12.suo
文件 7499 2017-09-09 21:51 PointCloudScanner\PointCloudScanner\PointCloudGrabber.cpp
文件 1533 2017-09-09 21:47 PointCloudScanner\PointCloudScanner\PointCloudGrabber.h
文件 1821 2017-09-10 09:06 PointCloudScanner\PointCloudScanner\PointCloudScanner.cpp
文件 3532 2017-09-10 09:14 PointCloudScanner\PointCloudScanner\PointCloudScanner.vcxproj
文件 1189 2017-09-10 09:14 PointCloudScanner\PointCloudScanner\PointCloudScanner.vcxproj.filters
相关资源
- C语言封装的HttpClient接口
- 三维点云边界提取
- Kinect手势控制鼠标
- 三维点云的圆柱面拟合
- 点云数据txt格式
- vc++三维点云数据的读取与显示
- 点云数据按高程赋色渲染.rar
- 求取点云体积
- kinect2.0数据采集及点云生成代码C++
- Kinect c++试验版的切水果游戏
- 点云压缩代码
- 点云数据处理---用opengl绘制显示并操
- 用C++实现点云显示
- PCL与MFC配合编译
- rabbitmq的C++客户端SimpleAmqpClient编译库
- 点云Las文件读写c++库 Lasib_msvc2015
- KinectV2 实现鼠标控制VS2013 C++版
- MFC kinect 骨骼识别
- 基于PCL的对点云的排序
- KinectV2彩色图片尺寸变换代码变换后与
- kinect+openGL+openNI+opencv实现三维重建
- Kinect2.0采集图像帧并保存
- MFC的HttpClient的Get和Post方法
- 轻量级C++实现的httpserver和httpclient
- Kinect2.0 骨骼点获取
- C++ httpclient类
- Kinectv2 __MFC
- HOUGH_LINE.cpp
- kinect+opengl 生成并显示点云
- Kinectv2_深度图和骨骼图源码
评论
共有 条评论