资源简介
需安装kinectSDK_v2.0,配置opencv和pcl库。可设置采集帧数,开始采集后会在本地保存相互对齐的彩色数据、深度数据和对应的点云文件
代码片段和文件信息
#include “prepare.h“
#define frameCount 5
int main(int argc char**argv)
{
clock_t time = clock();
//preparatory work
Kinect kinect;
if (kinect.kinectStart() != 0)
{
cout << “failed to start“;
return -1;
}
//prepare buffer
Mat DepthBuffer(Image::iDepthHeight Image::iDepthWidth CV_16UC1);
Mat DepthBufferT(Image::iDepthHeight Image::iDepthWidth CV_8UC1);
Mat ColorBuffer(Image::iColorHeight Image::iColorWidth CV_8UC4);
Mat MappedColor(Image::iDepthHeight Image::iDepthWidth CV_8UC3);
Mat MappedDepth(Image::iColorHeight Image::iColorWidth CV_8UC1);
ColorSpacePoint* pColorSpacePoint = new ColorSpacePoint[Image::iDepthframeSize];
DepthSpacePoint* pDepthSpacePoint = new DepthSpacePoint[Image::iColorframeSize];
CameraSpacePoint* pCameraSpacePoint = new CameraSpacePoint[Image::iColorframeSize];
//prepare image file
string str[frameCount];
for (int i = 0; i < frameCount; i++)
{
char c[3];
_itoa(i c 10);
str[i] = c;
}
//get frame info
for (int i = 0; i < frameCount; i++)
{
//get depth data
while (kinect.pDepthframeReader->AcquireLatestframe(&kinect.pDepthframe) != S_OK);
while (kinect.pDepthframe->CopyframeDataToArray(Image::iDepthframeSize (UINT16*)DepthBuffer.data) != S_OK);
kinect.releaseDepthframe();
DepthBuffer.convertTo(DepthBufferT CV_8U 255.0f / Image::iDepthMax);
//get color data
while (kinect.pColorframeReader->AcquireLatestframe(&kinect.pColorframe) != S_OK);
while (kinect.pColorframe->CopyConvertedframeDataToArray(Image::iColorframeSize * 4 ColorBuffer.data ColorImageFormat_Bgra) != S_OK);
kinect.releaseColorframe();
//prepare point cloud data buffer
PointCloud::Ptr cloud_depth(new PointCloud);
cloud_depth->width = Image::iDepthWidth;
cloud_depth->height = Image::iDepthHeight;
cloud_depth->is_dense = false;
cloud_depth->resize(Image::iDepthframeSize);
/*PointCloud::Ptr cloud_color(new PointCloud);
cloud_color->width = Image::iColorWidth;
cloud_color->height = Image::iColorHeight;
cloud_color->is_dense = false;
cloud_color->resize(Image::iColorframeSize);*/
//map coordinate
kinect.coordinateMap((UINT16*)DepthBuffer.data pColorSpacePoint pCameraSpacePoint &MappedColor &ColorBuffer cloud_depth);
//kinect.coordinateMap((UINT16*)DepthBuffer.data pDepthSpacePoint pCameraSpacePoint &MappedDepth DepthBufferT.data &ColorBuffer cloud_color);
//save mapped depth-color image
imwrite(“g://“ + str[i] + “1depth.png“ DepthBufferT);
imwrite(“g://“ + str[i] + “1color.png“ MappedColor);
io::savePCDFile(“g://“ + str[i] + “1depth.pcd“ *cloud_depth);
//imwrite(“g://“ + str[i] + “0color.png“ ColorBuffer);
//imwrite(“g://“ + str[i] + “0depth.png“ MappedDepth);
//io::savePLYFile(“g://“ + str[i] + “0color.ply“ *cloud_color);
}
//release dynamic array
delete[] pColorSpacePoint;
delete[] pDepthSpacePoint;
delete[] pCamer
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7728 2017-04-03 21:56 3D_Reconstruction1\3D_Reconstruction\3D_Reconstruction.vcxproj
文件 1177 2017-04-03 21:56 3D_Reconstruction1\3D_Reconstruction\3D_Reconstruction.vcxproj.filters
文件 634 2017-04-03 20:19 3D_Reconstruction1\3D_Reconstruction\3D_Reconstruction.vcxproj.user
文件 3119 2017-05-09 02:04 3D_Reconstruction1\3D_Reconstruction\main.cpp
文件 9456 2017-05-08 18:40 3D_Reconstruction1\3D_Reconstruction\prepare.cpp
文件 1346 2017-05-08 01:26 3D_Reconstruction1\3D_Reconstruction\prepare.h
文件 168 2017-05-09 02:02 3D_Reconstruction1\3D_Reconstruction\x64\Debug\3D_Recon.923DBE24.tlog\3D_Reconstruction.lastbuildstate
文件 12504 2017-05-09 02:02 3D_Reconstruction1\3D_Reconstruction\x64\Debug\3D_Recon.923DBE24.tlog\cl.command.1.tlog
文件 1447542 2017-05-09 02:02 3D_Reconstruction1\3D_Reconstruction\x64\Debug\3D_Recon.923DBE24.tlog\CL.read.1.tlog
文件 4234 2017-05-09 02:02 3D_Reconstruction1\3D_Reconstruction\x64\Debug\3D_Recon.923DBE24.tlog\CL.write.1.tlog
文件 15536 2017-05-09 02:02 3D_Reconstruction1\3D_Reconstruction\x64\Debug\3D_Recon.923DBE24.tlog\li
文件 31766 2017-05-09 02:02 3D_Reconstruction1\3D_Reconstruction\x64\Debug\3D_Recon.923DBE24.tlog\li
文件 728 2017-05-09 02:02 3D_Reconstruction1\3D_Reconstruction\x64\Debug\3D_Recon.923DBE24.tlog\li
文件 7899 2017-05-09 02:02 3D_Reconstruction1\3D_Reconstruction\x64\Debug\3D_Reconstruction.log
文件 2155213 2017-05-09 02:02 3D_Reconstruction1\3D_Reconstruction\x64\Debug\main.obj
文件 1778604 2017-04-03 21:40 3D_Reconstruction1\3D_Reconstruction\x64\Debug\mainMapToDepth.obj
文件 1783053 2017-04-03 20:37 3D_Reconstruction1\3D_Reconstruction\x64\Debug\main_MapToDepth.obj
文件 311844 2017-03-28 17:03 3D_Reconstruction1\3D_Reconstruction\x64\Debug\main_test.obj
文件 338833 2017-03-29 20:41 3D_Reconstruction1\3D_Reconstruction\x64\Debug\main_test3.obj
文件 274642 2017-03-28 17:00 3D_Reconstruction1\3D_Reconstruction\x64\Debug\main_test_1.obj
文件 301148 2017-03-29 15:10 3D_Reconstruction1\3D_Reconstruction\x64\Debug\mian_test2.obj
文件 1146081 2017-05-08 18:46 3D_Reconstruction1\3D_Reconstruction\x64\Debug\prepare.obj
文件 12160000 2017-05-09 02:02 3D_Reconstruction1\3D_Reconstruction\x64\Debug\vc120.idb
文件 15437824 2017-05-09 02:02 3D_Reconstruction1\3D_Reconstruction\x64\Debug\vc120.pdb
文件 7274496 2018-06-20 14:58 3D_Reconstruction1\3D_Reconstruction.sdf
文件 1351 2017-03-28 10:24 3D_Reconstruction1\3D_Reconstruction.sln
..A..H. 58368 2018-06-20 14:58 3D_Reconstruction1\3D_Reconstruction.v12.suo
文件 329216 2017-05-09 02:02 3D_Reconstruction1\x64\Debug\3D_Reconstruction.exe
文件 2671204 2017-05-09 02:02 3D_Reconstruction1\x64\Debug\3D_Reconstruction.ilk
文件 17272832 2017-05-09 02:02 3D_Reconstruction1\x64\Debug\3D_Reconstruction.pdb
............此处省略10个文件信息
- 上一篇:grabcut的c++源代码
- 下一篇:opencv之数字识别
相关资源
- Kinect c++试验版的切水果游戏
- TCPIP实用程序&温度数据采集系统程序
- usb2187数据采集卡的程序
- 基于C++的三菱机床实时数据采集可运
- KinectV2 实现鼠标控制VS2013 C++版
- MFC kinect 骨骼识别
- KinectV2彩色图片尺寸变换代码变换后与
- kinect+openGL+openNI+opencv实现三维重建
- Kinect2.0采集图像帧并保存
- 声卡数据采集播放演示源程序vc.zip
- Kinect2.0 骨骼点获取
- 基于STM32单片机的多路数据采集系统设
- Kinectv2 __MFC
- C++ 数据采集
- kinect+opengl 生成并显示点云
- Kinectv2_深度图和骨骼图源码
- Kinect2.0+PCL实现点云显示
- Kinect v2 跌到检测函数
- 激光雷达UTM-30LX图像采集程序及数据
- 基于Camshift+Kalman的多目标跟踪
- ADC0809做的电压+电流+功率数据采集系
- Kinect程序开发帮助文档C++
- 点云生成深度图,并保存深度图
- vc++ 数据采集卡编程
- 完整的实时深度图平滑代码像素滤波
- 基于VC++6.0的串口实时数据采集及实时
- VC环境下高速实时数据采集的实现
- 4G远程温湿度数据采集系统(原理图和
- Sick LMS激光雷达数据采集程序
- opencv2深度图滤波
评论
共有 条评论