资源简介
使用Kinect2.0获取人体骨骼,并使用openCV实时绘制,里面为VisualStudio2015工程文件,配置好Kinect开发环境可直接用VS2015打开并运行

代码片段和文件信息
#include
#include
#include //opencv头文件
#include
#include
#include //Kinect头文件
using namespace std;
using namespace cv;
void draw(Mat & img Joint & r_1 Joint & r_2 ICoordinateMapper * myMapper);
int main(void)
{
IKinectSensor * mySensor = nullptr;
GetDefaultKinectSensor(&mySensor);
mySensor->Open();
IColorframeSource * myColorSource = nullptr;
mySensor->get_ColorframeSource(&myColorSource);
IColorframeReader * myColorReader = nullptr;
myColorSource->OpenReader(&myColorReader);
int colorHeight = 0 colorWidth = 0;
iframeDescription * myDescription = nullptr;
myColorSource->get_frameDescription(&myDescription);
myDescription->get_Height(&colorHeight);
myDescription->get_Width(&colorWidth);
IColorframe * myColorframe = nullptr;
Mat original(colorHeight colorWidth CV_8UC4);
//**********************以上为Colorframe的读取前准备**************************
IBodyframeSource * myBodySource = nullptr;
mySensor->get_BodyframeSource(&myBodySource);
IBodyframeReader * myBodyReader = nullptr;
myBodySource->OpenReader(&myBodyReader);
int myBodyCount = 0;
myBodySource->get_BodyCount(&myBodyCount);
IBodyframe * myBodyframe = nullptr;
ICoordinateMapper * myMapper = nullptr;
mySensor->get_CoordinateMapper(&myMapper);
int abc = 0;
ofstream ofile;
//**********************以上为Bodyframe以及Mapper的准备***********************
while (1)
{
while (myColorReader->AcquireLatestframe(&myColorframe) != S_OK);
myColorframe->CopyConvertedframeDataToArray(colorHeight * colorWidth * 4 original.data ColorImageFormat_Bgra);
Mat copy = original.clone(); //读取彩色图像并输出到矩阵
while (myBodyReader->AcquireLatestframe(&myBodyframe) != S_OK); //读取身体图像
IBody ** myBodyArr = new IBody *[myBodyCount]; //为存身体数据的数组做准备
for (int i = 0; i < myBodyCount; i++)
myBodyArr[i] = nullptr;
if (myBodyframe->GetAndRefreshBodyData(myBodyCount myBodyArr) == S_OK) //把身体数据输入数组
for (int i = 0; i < myBodyCount; i++)
{
BOOLEAN result = false;
if (myBodyArr[i]->get_IsTracked(&result) == S_OK && result) //先判断是否侦测到
{
Joint myJointArr[JointType_Count];
if (myBodyArr[i]->GetJoints(JointType_Count myJointArr) == S_OK) //如果侦测到就把关节数据输入到数组并画图
{
ofile.open(“C:\\Users\\z\\Desktop\\out.txt“ ios::app); //作为输出文件打开
ofile< ofile.close();
cout < abc += 1;
draw(copy myJointArr[JointType_Head] myJointArr[JointType_Neck] myMapper);
draw(copy myJo
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
.CA..H. 25088 2017-12-29 08:49 Project1\.vs\Project1\v14\.suo
.CA.... 113664 2017-12-23 19:13 Project1\Debug\Project1.exe
.CA.... 619740 2017-12-23 19:13 Project1\Debug\Project1.ilk
.CA.... 1929216 2017-12-23 19:13 Project1\Debug\Project1.pdb
.CA.... 1116 2017-12-22 22:02 Project1\Project1\Debug\Project1.Build.CppClean.log
.CA.... 1714 2017-12-23 19:13 Project1\Project1\Debug\Project1.log
.CA.... 734 2017-12-23 19:13 Project1\Project1\Debug\Project1.tlog\CL.command.1.tlog
.CA.... 39914 2017-12-23 19:13 Project1\Project1\Debug\Project1.tlog\CL.read.1.tlog
.CA.... 648 2017-12-23 19:13 Project1\Project1\Debug\Project1.tlog\CL.write.1.tlog
.CA.... 1496 2017-12-23 19:13 Project1\Project1\Debug\Project1.tlog\li
.CA.... 3608 2017-12-23 19:13 Project1\Project1\Debug\Project1.tlog\li
.CA.... 632 2017-12-23 19:13 Project1\Project1\Debug\Project1.tlog\li
.CA.... 224 2017-12-23 19:13 Project1\Project1\Debug\Project1.tlog\Project1.lastbuildstate
.CA.... 1469440 2017-12-23 19:13 Project1\Project1\Debug\vc140.idb
.CA.... 1175552 2017-12-23 19:13 Project1\Project1\Debug\vc140.pdb
.CA.... 330193 2017-12-23 19:13 Project1\Project1\Debug\源.obj
.CA.... 6950 2017-12-22 22:02 Project1\Project1\Project1.vcxproj
.CA.... 944 2017-12-22 21:42 Project1\Project1\Project1.vcxproj.filters
.CA.... 165 2017-12-22 21:29 Project1\Project1\Project1.vcxproj.user
.CA.... 6210 2017-12-23 19:13 Project1\Project1\源.cpp
.CA.... 1306 2017-12-22 21:22 Project1\Project1.sln
.CA.... 35340288 2018-01-04 22:12 Project1\Project1.VC.db
.C.D... 0 2018-01-09 10:05 Project1\.vs\Project1\v14
.C.D... 0 2018-01-09 10:06 Project1\Project1\Debug\Project1.tlog
.C.D... 0 2018-01-09 10:05 Project1\.vs\Project1
.C.D... 0 2018-01-09 10:06 Project1\Project1\Debug
.C.D.H. 0 2018-01-09 10:05 Project1\.vs
.C.D... 0 2018-01-09 10:05 Project1\Debug
.C.D... 0 2018-01-09 10:06 Project1\Project1
.C.D... 0 2018-01-09 10:05 Project1
............此处省略3个文件信息
相关资源
- 基于OpenCV的数字识别468815
- 使用opencv去掉二值化图像中黑色面积
- opencv环境配置
- win10 64位下编译的opencv4.5.5库,opencv
- NVIDIAOpticalFlowSDK-79c6cee80a2df9a196f20afd6
- opencv_contrib-3.4.0.zip
- opencv2.4.9源码分析——SIFT
- 用两个摄像头实现,双目标定,双目
- opencv_traincascade训练分类器,手势识别
- opencv3.0交叉编译用parallel.cpp
- 基于opencv的图像识别识别图像中的色
- 基于openCV的识别特定颜色区域
- 基于OpenCV的分水岭算法实现
- QT+opencv+OCR 身份证号码,银行卡号识别
- opencv视频特定颜色区域识别
- 把RGB转换为HSV和HSI然后根据黄色和蓝
- opencv视觉测距
- 基于Qt和opencv的身份证号码识别系统
- opencv_ffmpeg249.dll
- SfM稀疏三维点云重建--完整工程文件
- 基于opencv的数人头程序源代码
- 利用OpenCV中的Stitcher类实现全景图像拼
- opencv实现的sift算法源码,包含了图像
- openCV 上的小波变换
- 基于OPENCV的车牌识别系统设计
- 617张国内车牌60-17bmp图片用于OpenCV正样
- hog特征提取,c版本代码
- 基于Qt5.8+OpenCV3.2的Basler多相机触发开
- 基于Opencv实现的图像纠偏
- ImageWatch2019.vsix
评论
共有 条评论