-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathmyKinect.h
46 lines (39 loc) · 1.34 KB
/
myKinect.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include <Kinect.h>
#include <opencv2\opencv.hpp>
// Safe release for interfaces
template<class Interface>
inline void SafeRelease(Interface *& pInterfaceToRelease)
{
if (pInterfaceToRelease != NULL)
{
pInterfaceToRelease->Release();
pInterfaceToRelease = NULL;
}
}
class CBodyBasics
{
//kinect 2.0 的深度空间的高*宽是 424 * 512,在官网上有说明
static const int cDepthWidth = 512;
static const int cDepthHeight = 424;
public:
CBodyBasics();
~CBodyBasics();
void Update();//获得骨架、背景二值图和深度信息
HRESULT InitializeDefaultSensor();//用于初始化kinect
private:
IKinectSensor* m_pKinectSensor;//kinect源
ICoordinateMapper* m_pCoordinateMapper;//用于坐标变换
IBodyFrameReader* m_pBodyFrameReader;//用于骨架数据读取
IDepthFrameReader* m_pDepthFrameReader;//用于深度数据读取
IBodyIndexFrameReader* m_pBodyIndexFrameReader;//用于背景二值图读取
//通过获得到的信息,把骨架和背景二值图画出来
void ProcessBody(int nBodyCount, IBody** ppBodies);
//画骨架函数
void DrawBone(const Joint* pJoints, const DepthSpacePoint* depthSpacePosition, JointType joint0, JointType joint1);
//画手的状态函数
void DrawHandState(const DepthSpacePoint depthSpacePosition, HandState handState);
//显示图像的Mat
cv::Mat skeletonImg;
cv::Mat depthImg;
};