文档介绍:wpfUI界面设计usingSystem;;;;;;;;;;;;;;namespaceKinectHubDemo{ publicpartialclassMainWindow:Window {KinectSensorkinect; privateList<Button>buttons;privateButtonhoveredButton; privateboolisWindowsClosing=false;///<summary>///启动Kinect设备,默认初始化选项,并注册AllFramesReady同步事件///</summary>privatevoidstartKinect(){if(>0){//选择第一个Kinect设备kinect=[0];if(kinect==null)return;();vartsp=newTransformSmoothParameters{Smoothing=,Correction=,Prediction=,JitterRadius=,MaxDeviationRadius=};(tsp);//启用骨骼跟踪,+=newEventHandler<ColorImageFrameReadyEventArgs>(kinect_ColorFrameReady);+=newEventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeletonFrameReady);文档来自于网络搜索//();}else{("没有发现任何Kinect设备");}}voidkinect_SkeletonFrameReady(objectsender,SkeletonFrameReadyEventArgse)文档来自于网络搜索{using(SkeletonFrameframe=())文档来自于网络搜索{if(frame==null)return;if(==0)return;Skeleton[]allSkeletons=newSkeleton[];(allSkeletons);//Linq语法,查找离Kinect最近的、被跟踪的骨骼,以头部Z坐标为参考SkeletonclosestSkeleton=(==&&[].TrackingState==).OrderBy(s=>[].)();if(closestSkeleton==null)return;if(!=)文档来自于网络搜索ret