资源简介
本人,在结合Kinect v2.0+ VS2012+openCV2.4.9,将彩色帧映射到深度空间,本想利用一些国内外的现有资料,怎奈只找到MapDepthrFrameToColorSpace,空间的转换,未找到现成的程序能够使用openCV2.4.9将Kinect v2.0里的彩色帧映射到深度空间里,故自己尝试着将MapColorFrameToDepthSpace在程序中实现,程序写出来,也能跑出来,映射也实现了,但还有点瑕疵。鉴于当前无相关标准结果参考,故上传于此,待同仁参考,期待改进。让我们一起来将Kinect v2.0+ VS2012+openCV2.4.9完美结合,将Kinect v2.0的所有功能完美呈现。

代码片段和文件信息
// CoodinateMapper.cpp : 定义控制台应用程序的入口点。
//
#include “stdafx.h“
#include
#include
#include
#include
using namespace cv;
using namespace std;
template
inline void SafeRelease( Interface *& pInterfaceToRelease )
{
if ( pInterfaceToRelease != NULL )
{
pInterfaceToRelease->Release();
pInterfaceToRelease = NULL;
}
}
int _tmain(int argc _TCHAR* argv[])
{
IKinectSensor* pSensor ;
HRESULT hResult = S_OK ;
hResult = GetDefaultKinectSensor( &pSensor );
if ( FAILED( hResult ) )
{
cerr << “Error:GetDefaultKinectSensor“ << endl;
return -1;
}
hResult = pSensor->Open();
if ( FAILED( hResult ) )
{
cerr << “Error:IKinectSensor::Open()“ << endl;
return -1;
}
IColorframeSource* pColorSource;
hResult = pSensor->get_ColorframeSource( &pColorSource );
if ( FAILED( hResult ) )
{
cerr << “Error:IKinectSensor::get_ColorframeSource()“ << endl;
return -1;
}
IColorframeReader* pColorReader;
hResult = pColorSource->OpenReader( &pColorReader );
if ( FAILED( hResult ) )
{
cerr << “Error:IColorframeSource::OpenReader()“ << endl;
return -1;
}
iframeDescription* pColorDescription;
hResult = pColorSource->get_frameDescription( &pColorDescription );
if ( FAILED( hResult ) )
{
cerr << “Error:IColorframeSource::get_frameDescription()“ << endl;
return -1;
}
int colorHeight = NULL;
int colorWidth = NULL;
pColorDescription->get_Height( &colorHeight );
pColorDescription->get_Width( &colorWidth );
unsigned int colorBufferSize = colorWidth * colorHeight * 4 * sizeof( unsigned char );
Mat colorBufferMat( colorHeight colorWidth CV_8UC4 );
Mat colorMat( colorHeight/2 colorWidth/2 CV_8UC4 );
namedWindow( “color“ CV_WINDOW_NORMAL );
IDepthframeSource* pDepthSource;
hResult = pSensor->get_DepthframeSource( &pDepthSource );
if ( FAILED( hResult ) )
{
cerr << “Error:IKinectSensor::get_DepthframeSource()“ << endl;
return -1;
}
IDepthframeReader* pDepthReader;
hResult = pDepthSource->OpenReader( &pDepthReader );
if ( FAILED( hResult ) )
{
cerr << “Error:IDepthframeSource::OpenReader()“ << endl;
return -1;
}
iframeDescription* pDepthDescription;
hResult = pDepthSource->get_frameDescription( &pDepthDescription );
if ( FAILED( hResult ) )
{
cerr << “Error:IDepthframeSource::get_frameDescription()“ << endl;
return -1;
}
int depthWidth = NULL;
int depthHeight = NULL;
pDepthDescription->get_Width( &depthWidth );
pDepthDescription-
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7499 2015-01-21 09:34 color-mapping-depth\color-mapping-depth\color-mapping-depth.cpp
文件 4658 2015-01-20 18:10 color-mapping-depth\color-mapping-depth\color-mapping-depth.vcxproj
文件 1323 2015-01-20 18:10 color-mapping-depth\color-mapping-depth\color-mapping-depth.vcxproj.filters
文件 1702 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\cl.command.1.tlog
文件 33370 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\CL.read.1.tlog
文件 1232 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\CL.write.1.tlog
文件 87 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\color-mapping-depth.lastbuildstate
文件 162 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\color-mapping-depth.log
文件 381545 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\color-mapping-depth.obj
文件 1245184 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\color-mapping-depth.pch
文件 2 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\li
文件 2 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\li
文件 2 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\li
文件 2 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\li
文件 2100 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\li
文件 4520 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\li
文件 826 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\li
文件 12092 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\stdafx.obj
文件 855040 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\vc110.idb
文件 1019904 2015-01-21 10:41 color-mapping-depth\color-mapping-depth\Debug\vc110.pdb
文件 5918 2015-01-20 08:31 color-mapping-depth\color-mapping-depth\mhi.cpp
文件 1594 2015-01-13 15:22 color-mapping-depth\color-mapping-depth\ReadMe.txt
文件 224 2015-01-13 15:22 color-mapping-depth\color-mapping-depth\stdafx.cpp
文件 233 2015-01-13 15:22 color-mapping-depth\color-mapping-depth\stdafx.h
文件 236 2015-01-13 15:22 color-mapping-depth\color-mapping-depth\targetver.h
文件 47644672 2015-03-11 10:38 color-mapping-depth\color-mapping-depth.sdf
文件 924 2015-01-13 15:22 color-mapping-depth\color-mapping-depth.sln
..A..H. 32768 2015-03-11 10:38 color-mapping-depth\color-mapping-depth.v11.suo
文件 99840 2015-01-21 10:41 color-mapping-depth\Debug\color-mapping-depth.exe
文件 483240 2015-01-21 10:41 color-mapping-depth\Debug\color-mapping-depth.ilk
............此处省略11个文件信息
相关资源
- 联想扬天电脑用户手册
- SentinelRMSToolkitv2.0.rar
- 美松打印机SDK MsPrintSDK-Demo-DLL-CShare-
- Visual Assist X 通用破解补丁v2.0 适用于
- 钰硕ar8151网卡驱动 win7 64位 win7/10/xp
- FinalData v2.01.1028 绿色版
- 影驰魔盘plus中文版 v2.0.0.7 官方最新版
- 最新BW量产工具——BW_Tool_v2.0
- Penpower蒙恬全能大笔宝驱动 v2.0.3 最新
- 华硕笔记本万能摄像头驱动v2.0官方正
- 广告报价助手 v2.02 官方免费版.zip
- 中国联通光纤分布系统网管技术规范
- Kinect手势代替鼠标控制PC
- U盘文件复制专家 V2.0.0 简体中文绿色
- 鼎付支付-信用卡-2方内嵌-适用于一键
- AB PLC 解密 sk万能钥匙V2.0 V13-V26解密
- 思量QQ亮钻大师 v2.0.zip
- Youtube_v2.0.zip
- XP win7启动菜单修复工具NTBOOTautofix v
- ESET NOD32序列号获取器v2.0
- 映美fp-730k打印机驱动 v2.0 官方最新版
- 正则表达式自动生成器 V2.0.0.1 官方多
- OllyICEv2.01b)和PEiD
- 1_HS6620_data_sheet_V2.0.pdf
- 使用OpenNI自带的类进行简单手势识别
- 耶鲁博弈论笔记全 24 讲 v2.0Apollo Gab
- Qt基础教程V2.0.doc
- 2018数模论文LaTex模板V2.0分解版
- 飞悦旅游景区线路连锁店版V2.0.2+分销
- 基于Kinect的三维重建
评论
共有 条评论