//注意:1.安装Kinect SDK 1.0以上, // 2.引用Microsoft.Kinect.dll库 private Graphics g;//界面画布对象 private KinectSensor kinect = null;//指向Kinect对象 private Skeleton[] skeletonData; //存储从Kinect传感器接收到的数据对象 private void StartKinectST() { // Get first Kinect Sensor kinect = KinectSensor.KinectSensors.FirstOrDefault(s => s.Status == KinectStatus.Connected); //注意:此判断MS目前无效 if (null == kinect) { this.ShowDialog(); } this.Text = "正在检测Kinect传感器..."; // 允许骨骼跟踪 kinect.SkeletonStream.Enable(); //关闭颜色和景深数据的接收 kinect.ColorStream.Disable(); kinect.DepthStream.Disable(); skeletonData = new Skeleton[kinect.SkeletonStream.FrameSkeletonArrayLength]; // Get Ready for Skeleton Ready Events kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeletonFrameReady); // Start Kinect sensor kinect.Start(); } //接收到数据的处理事件 private void kinect_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { try { ////Tracked that defines whether a skeleton is 'tracked' or not. ////The untracked skeletons only give their position. //if (SkeletonTrackingState.Tracked != data.TrackingState) continue; this.Text = "Kinect传感器连结成功!"; using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame()) // Open the Skeleton frame { // check that a frame is available if (skeletonFrame != null && this.skeletonData != null) { // get the skeletal information in this frame skeletonFrame.CopySkeletonDataTo(this.skeletonData); } } foreach (Skeleton skeleton in this.skeletonData) { if (null != skeleton) { if (skeleton.TrackingState == SkeletonTrackingState.Tracked) { Console.WriteLine("KinectID: " + skeleton.TrackingId); //只处理跟踪移动的数据 DrawTrackedSkeletonJoints(skeleton.Joints); } else if (skeleton.TrackingState == SkeletonTrackingState.PositionOnly) { //temDrawSkeletonPosition(skeleton.Position); } } else { Console.WriteLine("null Skeleton"); } } } catch (Exception ex) { this.Text="Kinect失去连结,请检查USB或电源"; } } //处理各个节点移动数据 private void DrawTrackedSkeletonJoints(JointCollection jointCollection) { // String s = kinect.UniqueKinectId; //以下为获取左右手、臂、膝盖、脚和头部的跟踪数据 // Render Head and Shoulders //DrawBone(jointCollection[JointType.Head], jointCollection[JointType.ShoulderCenter]); //DrawBone(jointCollection[JointType.ShoulderCenter], jointCollection[JointType.ShoulderLeft]); //DrawBone(jointCollection[JointType.ShoulderCenter], jointCollection[JointType.ShoulderRight]); // Render Left Arm drarHand(true,jointCollection[JointType.HandLeft]); //DrawBone(jointCollection[JointType.ShoulderLeft], jointCollection[JointType.ElbowLeft]); // DrawBone(jointCollection[JointType.ElbowLeft], jointCollection[JointType.WristLeft]); //DrawBone(jointCollection[JointType.WristLeft], jointCollection[JointType.HandLeft]); // Render Right Arm drarHand(false,jointCollection[JointType.HandRight]); //DrawBone(jointCollection[JointType.ShoulderRight], jointCollection[JointType.ElbowRight]); // DrawBone(jointCollection[JointType.ElbowRight], jointCollection[JointType.WristRight]); //DrawBone(jointCollection[JointType.WristRight], jointCollection[JointType.HandRight]); // Render other bones... } int srcXLeft, srcYLeft; int srcXRight, srcYRight; //画左右手的点 private void drarHand(Boolean isLeft,Joint joint) { if (joint.TrackingState == JointTrackingState.Tracked && joint.TrackingState == JointTrackingState.Tracked) { ColorImagePoint cp1 = kinect.MapSkeletonPointToColor(joint.Position, ColorImageFormat.RgbResolution640x480Fps30); Point po = new Point((int)cp1.X, (int)cp1.Y); Console.WriteLine("to draw Ellipse x:" + po.X + " y:" + po.Y); if (isLeft) { Pen srcP = new Pen(this.BackColor, 4); g.DrawEllipse(srcP, srcXLeft, srcYLeft, 30,10); Pen p = new Pen(Color.Red, 4); g.DrawEllipse(p, po.X, po.Y, 30, 10); srcXLeft = po.X; srcYLeft = po.Y; } else { Pen srcP = new Pen(this.BackColor, 4); g.DrawEllipse(srcP, srcXRight, srcYRight,20, 20); Pen p = new Pen(Color.Green, 4); g.DrawEllipse(p, po.X, po.Y, 20, 20); srcXRight = po.X; srcYRight = po.Y; } } } }
相关推荐
以前收集的 KinectEarthMove zip Kinect Adjustable Angle 1 rar paint 代码 zip KinectRipplelicious zip KinectEarthMove zip 还有就不列了
Kinect Demo,最新的beta1版本
Robert Walter的kinect手指识别算法,需要用到openni和opencv
利用 processing 和 kinect 实现一定区域范围内的物体字符化
基于Kinect的人脸识别代码的实现。使用了三维人脸跟踪,PCA人脸识别,统计方法,和正脸判断。
kinectfusion程序,亲测可以使用。重建效果很好。可以把模型保存为多种格式 obj ply stl
以前做kinect的时候网上都没有kinect录视频的代码,无奈自己写一个吧,就当抛砖引玉了。
KINECT基本功能实用套件(vb.net) 深度检测 骨骼(扔出坐标) 普通摄像头
用C++语言借助Openni开发了基于Kinect的插件,通过该插件在virtools环境中读取Kinect数据,进行手势识别和跟踪。
《Kinect for Windows SDK v2 0 开发笔记 十八 Fusion 基本2D显示》所附带资源
利用kinect进行视觉识别、深度识别的代码
kinect获取摄像头内参Matlab代码
kinect 可实现与用户交互。通过滚动条滚动,显示不同的按钮,点击按钮可显示相应文本。
kinect驱动源代码
资源包含源代码、可执行程序,项目。 本资源与Blog《Kinect开发之体感举起手来程序设计(Kinect俄罗斯方块)》配套。 如果您下载到了本资源。请去blog上看原文,方便一起学习交流。 游戏需要Kinect SDK的支持,请先...
读取并显示kinect彩色和...利用OpenNI读取kinect代码非常简单,不再做解释。利用OpenNI读取信息的时候,要正确安装OpenNI和对应的Kinect驱动。 利用本资源提供的源代码,配置好OpenCv,OpenNI和KinectSDK即可运行。
对Kinect硬件结构进行说明,对生成的彩色图像、深度图像、骨骼数据进行进一步的说明,基本的获取数据类型。
介绍基本的kinect技术开发的文档!共享给大家使用。