资源简介
使用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实现相机标定程序
- opencv 实现 meanshift 的目标跟踪
- opencv 的knn的训练数据
- 单高斯背景建模opencv
- opencv高斯滤波模板及其滤波
- 基于OpenCV实现Retinex
- 虹膜识别VC2008+opencv2.3.1源码,改编自
- protobuf-cpp-3.1.0.tar.gz 下载192823
- opencv_xxx.310d.lib
- openCV图像检测资源包
- Opencv 下Cascade Classifier实现人脸识别的
-
opencv车牌识别xm
l文件 - Canny算子源代码
- 双目已知图像坐标求空间坐标opencv
- h264+ffmpeg+opencv开发手册
- opencvjs编译后的文件
- OpenCV图像处理教程 - 贾志刚 课程配套
- boostdesc vgg_generated.zip
- 机器视觉标定板选型表-凯林博
- opencv源程序
- 全景拼接_多张图像拼接(stitching_de
- protobuf-cpp-3.1.0.tar.gz 配置文件
- 图像特征点提取与匹配
- opencv获取图像像素值
- 动作识别 Hu距 SVM opencv2.4.9 VS2013
- createsamples.exe和haartraining.exe及所需d
- opencv车牌识别系统可直接运行
- 基于opencv与yolo的目标识别案例
- svm颜色分类
- QT OPENCV车牌识别 识别结果输出到Tex
评论
共有 条评论