最近学习kinect需要在CSDN下载一些资源,没有积分无奈只能将自己总结的一些材料发到CSDN以赚取积分。。。
- kinect2显示彩色图像
#include
#include <Kinect.h>
#include <opencv2\highgui.hpp>
using namespace std;
using namespace cv;
int main(void)
{
IKinectSensor * mySensor = nullptr; //第1步打开Sensor
GetDefaultKinectSensor(&mySensor);
mySensor->Open();
IColorFrameSource * mySource = nullptr; //第2步获取Source
mySensor->get_ColorFrameSource(&mySource);
int height = 0, width = 0; //取得宽和高等下用
IFrameDescription * myDescription = nullptr;
mySource->get_FrameDescription(&myDescription);
myDescription->get_Height(&height);
myDescription->get_Width(&width);
IColorFrameReader * myReader = nullptr; //第3步打开Reader
mySource->OpenReader(&myReader);
Mat img(height, width, CV_8UC4);
IColorFrame * myFrame = nullptr;
while (1)
{