• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Kinect.Skeleton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Kinect.Skeleton的典型用法代码示例。如果您正苦于以下问题:C# Skeleton类的具体用法?C# Skeleton怎么用?C# Skeleton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Skeleton类属于Microsoft.Kinect命名空间,在下文中一共展示了Skeleton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RenderClippedEdges

        private static void RenderClippedEdges(Skeleton skeleton, DrawingContext drawingContext)
        {
            if (skeleton.ClippedEdges.HasFlag(FrameEdges.Bottom))
            {
                drawingContext.DrawRectangle(
                    Brushes.Red,
                    null,
                    new Rect(0, RenderHeight - ClipBoundsThickness, RenderWidth, ClipBoundsThickness));
            }

            if (skeleton.ClippedEdges.HasFlag(FrameEdges.Top))
            {
                drawingContext.DrawRectangle(
                    Brushes.Red,
                    null,
                    new Rect(0, 0, RenderWidth, ClipBoundsThickness));
            }

            if (skeleton.ClippedEdges.HasFlag(FrameEdges.Left))
            {
                drawingContext.DrawRectangle(
                    Brushes.Red,
                    null,
                    new Rect(0, 0, ClipBoundsThickness, RenderHeight));
            }

            if (skeleton.ClippedEdges.HasFlag(FrameEdges.Right))
            {
                drawingContext.DrawRectangle(
                    Brushes.Red,
                    null,
                    new Rect(RenderWidth - ClipBoundsThickness, 0, ClipBoundsThickness, RenderHeight));
            }
        }
开发者ID:nathad02,项目名称:CITS3200--Group-H,代码行数:34,代码来源:MainWindow.xaml.cs


示例2: UpdateAllGestures

 /// <summary>
 /// launch the update on all gestures relying on skeleton datas
 /// </summary>
 /// <param name="skel">the skeleton datas</param>
 /// <param name="gesture_context">the context when the gesture is triggered</param>
 public void UpdateAllGestures(Skeleton skel, ContextGesture gesture_context)
 {
     foreach (BodyGesture bg in this.gestures)
     {
         bg.updateGesture(skel, gesture_context);
     }
 }
开发者ID:HaKDMoDz,项目名称:kinectQlikView,代码行数:12,代码来源:BodyGestureControler.cs


示例3: ResetAll

 public void ResetAll(Skeleton skeleton)
 {
     foreach (var state in _gesturestate)
     {
         state.Reset();
     }
 }
开发者ID:UPS-CS240-F12,项目名称:motion-capture,代码行数:7,代码来源:GestureMapState.cs


示例4: TrackGesture

        private void TrackGesture(Skeleton skeleton, ref GestureTracker tracker, long timeStamp)
        {
            Joint leftHand = skeleton.Joints[JointType.HandLeft];
            Joint rightHand = skeleton.Joints[JointType.HandRight];

            if (leftHand.TrackingState != JointTrackingState.NotTracked && rightHand.TrackingState != JointTrackingState.NotTracked)
            {
                if (tracker.State == GestureState.InProcess && tracker.TimeStamp + _TIMEOUT <= timeStamp)
                    //响应超时
                    tracker.UpdateState(GestureState.Failure, timeStamp);
                else
                {
                    if (tracker.State == GestureState.InProcess)
                    {
                        if (Math.Abs(leftHand.Position.X - rightHand.Position.X) >= UPPER_THRESHOLD || Math.Abs(leftHand.Position.Y - rightHand.Position.Y) >= UPPER_THRESHOLD)
                        {
                            tracker.UpdateState(GestureState.Success, timeStamp);
                            if (GestureDetected != null)
                                GestureDetected(this, new EventArgs());
                        }
                    }
                    else
                    {
                        if (Math.Abs(leftHand.Position.Y - rightHand.Position.Y) < LOWER_THRESHOLD && Math.Abs(leftHand.Position.X - rightHand.Position.X) <= LOWER_THRESHOLD)
                            tracker.UpdatePosition(timeStamp);
                        else
                            tracker.Reset();
                    }
                }
            }
            else
                tracker.Reset();
        }
开发者ID:cnyangyijai,项目名称:Kinect,代码行数:33,代码来源:_TvSwitchGesture.cs


示例5: CheckForGesture

        public virtual bool CheckForGesture(Skeleton skeleton)
        {
            if (this.IsRecognitionStarted == false)
            {
                if (this.ValidateGestureStartCondition(skeleton))
                {
                    this.IsRecognitionStarted = true;
                    this.CurrentFrameCount = 0;
                }
            }

            else
            {
                if (this.CurrentFrameCount == this.MaximumNumberOfFrameToProcess)
                {
                    this.IsRecognitionStarted = false;
                    if (ValidateBaseCondition(skeleton) && ValidateGestureEndCondition(skeleton))
                    {
                        return true;
                    }
                }

                this.CurrentFrameCount++;

                if (!IsGestureValid(skeleton) && !ValidateBaseCondition(skeleton))
                {
                    this.IsRecognitionStarted = false;
                }
            }

            return false;
        }
开发者ID:cs247stanford,项目名称:jarm,代码行数:32,代码来源:GestureBase.cs


示例6: PosicaoValida

        protected override bool PosicaoValida(Skeleton esqueletoUsuario)
        {
            Joint centroOmbros = esqueletoUsuario.Joints[JointType.ShoulderCenter];
            Joint maoDireita = esqueletoUsuario.Joints[JointType.HandRight];
            Joint cotoveloDireito = esqueletoUsuario.Joints[JointType.ElbowRight];
            Joint maoEsquerda = esqueletoUsuario.Joints[JointType.HandLeft];
            Joint cotoveloEsquerdo = esqueletoUsuario.Joints[JointType.ElbowLeft];
            double margemErro = 0.30;

            bool maoDireitaAlturaCorreta = Util.CompararComMargemErro(margemErro, maoDireita.Position.Y, centroOmbros.Position.Y);
            bool maoDireitaDistanciaCorreta = Util.CompararComMargemErro(margemErro, maoDireita.Position.Z, centroOmbros.Position.Z);
            bool maoDireitaAposCotovelo = maoDireita.Position.X > cotoveloDireito.Position.X;

            bool cotoveloDireitoAlturaCorreta = Util.CompararComMargemErro(margemErro, cotoveloDireito.Position.Y, centroOmbros.Position.Y);
            bool cotoveloEsquerdoAlturaCorreta = Util.CompararComMargemErro(margemErro, cotoveloEsquerdo.Position.Y, centroOmbros.Position.Y);

            bool maoEsquerdaAlturaCorreta = Util.CompararComMargemErro(margemErro, maoEsquerda.Position.Y, centroOmbros.Position.Y);
            bool maoEsquerdaDistanciaCorreta = Util.CompararComMargemErro(margemErro, maoEsquerda.Position.Z, centroOmbros.Position.Z);
            bool maoEsquerdaAposCotovelo = maoEsquerda.Position.X < cotoveloEsquerdo.Position.X;
            

            return maoDireitaAlturaCorreta && 
                   maoDireitaDistanciaCorreta && 
                   maoDireitaAposCotovelo &&
                   cotoveloDireitoAlturaCorreta &&
                   maoEsquerdaAlturaCorreta && 
                   maoEsquerdaDistanciaCorreta &&
                   maoEsquerdaAposCotovelo &&
                   cotoveloEsquerdoAlturaCorreta;
        }
开发者ID:gilgaljunior,项目名称:CrieAplicacoesInterativascomoMicrosoftKinect,代码行数:30,代码来源:PoseT.cs


示例7: skelData

 public skelData(Skeleton skel)
 {
     sx = skel.Position.X;
     sy = skel.Position.Y;
     sz = skel.Position.Z;
     spread = 0; //not coded yet!!
 }
开发者ID:tklebanoff,项目名称:kinect2osc,代码行数:7,代码来源:skelData.cs


示例8: AppendSkeleton

        public void AppendSkeleton(Skeleton skeleton)
        {
            SkeletonPoint head = skeleton.Joints[JointType.Head].Position;
            SkeletonPoint shoulderCenter = skeleton.Joints[JointType.ShoulderCenter].Position;
            SkeletonPoint shoulderLeft = skeleton.Joints[JointType.ShoulderLeft].Position;
            SkeletonPoint shoulderRight = skeleton.Joints[JointType.ShoulderRight].Position;

            SkeletonPoint elbowLeft = skeleton.Joints[JointType.ElbowLeft].Position;
            SkeletonPoint wristLeft = skeleton.Joints[JointType.WristLeft].Position;
            SkeletonPoint handLeft = skeleton.Joints[JointType.HandLeft].Position;

            SkeletonPoint elbowRight = skeleton.Joints[JointType.ElbowRight].Position;
            SkeletonPoint wristRight = skeleton.Joints[JointType.WristRight].Position;
            SkeletonPoint handRight = skeleton.Joints[JointType.HandRight].Position;

            StringBuilder sb = new StringBuilder();
            sb.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")+", ");
            sb.Append(head.X.ToString() + "," + head.Y.ToString() + "," + head.Z.ToString() + ",");
            sb.Append(shoulderCenter.X + "," + shoulderCenter.Y + "," + shoulderCenter.Z + ",");
            sb.Append(shoulderLeft.X + "," + shoulderLeft.Y + "," + shoulderLeft.Z + ",");
            sb.Append(shoulderRight.X + "," + shoulderRight.Y + "," + shoulderRight.Z + ",");

            sb.Append(elbowLeft.X + "," + elbowLeft.Y + "," + elbowLeft.Z + ",");
            sb.Append(wristLeft.X + "," + wristLeft.Y + "," + wristLeft.Z + ",");
            sb.Append(handLeft.X + "," + handLeft.Y + "," + handLeft.Z + ",");

            sb.Append(elbowRight.X + "," + elbowRight.Y + "," + elbowRight.Z + ",");
            sb.Append(wristRight.X + "," + wristRight.Y + "," + wristRight.Z + ",");
            sb.Append(handRight.X + "," + handRight.Y + "," + handRight.Z);

            AppendSkeletonString(sb.ToString());
        }
开发者ID:Cheat-Bluff,项目名称:Cheat-Bluff,代码行数:32,代码来源:SkeletonLogger.cs


示例9: CheckGesture

        public GesturePartResult CheckGesture(Skeleton skeleton)
        {
            double LeftA = Math.Sqrt((Math.Pow(skeleton.Joints[JointType.KneeLeft].Position.Z - skeleton.Joints[JointType.FootLeft].Position.Z, 2) + Math.Pow(skeleton.Joints[JointType.KneeLeft].Position.Y - skeleton.Joints[JointType.FootLeft].Position.Y, 2)));
            double LeftB = Math.Sqrt((Math.Pow(skeleton.Joints[JointType.HipRight].Position.Z - skeleton.Joints[JointType.KneeLeft].Position.Z, 2) + Math.Pow(skeleton.Joints[JointType.HipLeft].Position.Y - skeleton.Joints[JointType.KneeLeft].Position.Y, 2)));
            double LeftC = skeleton.Joints[JointType.HipLeft].Position.Y - skeleton.Joints[JointType.FootLeft].Position.Y;

            double RightA = Math.Sqrt((Math.Pow(skeleton.Joints[JointType.KneeRight].Position.Z - skeleton.Joints[JointType.FootRight].Position.Z, 2) + Math.Pow(skeleton.Joints[JointType.KneeRight].Position.Y - skeleton.Joints[JointType.FootRight].Position.Y, 2)));
            double RightB = Math.Sqrt((Math.Pow(skeleton.Joints[JointType.HipRight].Position.Z - skeleton.Joints[JointType.KneeRight].Position.Z, 2) + Math.Pow(skeleton.Joints[JointType.HipRight].Position.Y - skeleton.Joints[JointType.KneeRight].Position.Y, 2)));
            double RightC = skeleton.Joints[JointType.HipRight].Position.Y - skeleton.Joints[JointType.FootRight].Position.Y;

            double LeftAngle = Math.Acos((Math.Pow(LeftA, 2) + Math.Pow(LeftB, 2) - Math.Pow(LeftC, 2)) / (2 * LeftA * LeftB));
            double RightAngle = Math.Acos((Math.Pow(RightA, 2) + Math.Pow(RightB, 2) - Math.Pow(RightC, 2)) / (2 * RightA * RightB));

            LeftAngle = (LeftAngle * 180) / Math.PI;
            RightAngle = (RightAngle * 180) / Math.PI;

            if (LeftAngle > 160 && RightAngle > 160)
            {
                NewHipCenterAverage = (skeleton.Joints[JointType.HipLeft].Position.Y + skeleton.Joints[JointType.HipCenter].Position.Y + skeleton.Joints[JointType.HipRight].Position.Y) / 3;
                if(NewHipCenterAverage - BendSegment1.HipCenterAverage < 0.04)
                {   
                return GesturePartResult.Succeed;
                }
                return GesturePartResult.Fail;
            }
            else 
            {
                return GesturePartResult.Pausing;
            }
        }
开发者ID:guozanhua,项目名称:kinect-ripple,代码行数:30,代码来源:BendSegment3.cs


示例10: IsGestureValid

 protected override bool IsGestureValid(Skeleton skeleton)
 {
     SkeletonPoint newLeft = skeleton.Joints[JointType.HandRight].Position;
     SkeletonPoint newRight = skeleton.Joints[JointType.HandRight].Position;
     if ((originLeft != newLeft) && (originRight != newRight)) return false;
     return true;
 }
开发者ID:h3nj3,项目名称:Kinect-Gesture-Recognizer,代码行数:7,代码来源:SickGesture.cs


示例11: Evaluate

        //Checks to see if the two joints are in either of the two states. Unless the beginning relationship has
        //been satisifed, it will not check the ending relationship.
        public bool Evaluate(Skeleton skeleton, int xScale, int yScale)
        {
            var sjoint1 = skeleton.Joints[_component.Joint1].ScaleTo(xScale, yScale);
            var sjoint2 = skeleton.Joints[_component.Joint2].ScaleTo(xScale, yScale);

            if (!BeginningRelationshipSatisfied)
            {
                var goodtogo = CompareJointRelationship(sjoint1, sjoint2, _component.BeginningRelationship);
                if (goodtogo)
                {
                    _beginningRelationshipSatisfied = true;
                }
                else
                {
                    return false;
                }
            }

            if (!EndingRelationshipSatisfied)
            {
                var goodtogo = CompareJointRelationship(sjoint1, sjoint2, _component.EndingRelationship);
                if (goodtogo)
                {
                    return _endingRelationshipSatisfied = true;
                }
                return false;
            }

            return true;
        }
开发者ID:UPS-CS240-F12,项目名称:motion-capture,代码行数:32,代码来源:GestureComponentState.cs


示例12: Add

        /// <summary>
        /// Dequeues from the queue if available and accepting
        /// </summary>
        /// <param name="skeleton">Skeletal array data from the SkeletonFrame</param>
        public void Add(Skeleton[] skeleton, long timeStamp)
        {
            // Is there any space left?
            if (free.Count == 0)
            {
                for (int i = 0; i < maxInstances; ++i)
                {
                    //   enqueue again so long as no one else is using this
                    if (!this.universe[i].InUse)
                    {
                        free.Enqueue(this.universe[i]);
                    }
                }
            }

            if (free.Count > 0)
            {
                SkeletonStamp s = free.Dequeue();
                s.TimeStamp = timeStamp;
                s.SkeletonData = skeleton;
                s.InUse = false;
                s.IsActive = true;
                //Debug.WriteLine("Adding {0}", free.Count);
            }
            else
            {
                Debug.WriteLine("Out of skeletons!  Consider increasing the max instances on initialization.");
            }
        }
开发者ID:slowbump,项目名称:KinectTherapyTest,代码行数:33,代码来源:SkeletonPool.cs


示例13: Pruefe

        /// <summary>
        /// Prueft die history, ob die jeweilige Bewegung ausgelöst wird oder nicht.
        /// </summary>
        /// <param name="history">The history.</param>
        /// <returns></returns>
        public ErkennerStatus Pruefe(Skeleton[] history)
        {
            var headY = history.Select(x => x.Joints[JointType.Head].Position.Y);
            var leftFootY = history.Select(x => x.Joints[JointType.FootLeft].Position.Y);

            bool unten = (headY.Max() - headY.First() > 0.15) && (leftFootY.First() - leftFootY.Min()) < 0.02;
            bool oben = (headY.First() - headY.Min() > 0.1) && (leftFootY.Max()-leftFootY.First()) < 0.02;

            if (Blocked)
            {
                if (BlockStopwatch.ElapsedMilliseconds > 700)
                {
                    Blocked = false;
                    BlockStopwatch = null;
                }
            }

            if (!Blocked)
            {
                if (_geduckt && oben)
                {
                    _geduckt = false;
                    MotionFunctions.SendAction(MotionFunctions.DownUp());
                    return ErkennerStatus.NichtAktiv;
                }
                if (!_geduckt && unten)
                {
                    _geduckt = true;
                    MotionFunctions.SendAction(MotionFunctions.DownDown());
                    return ErkennerStatus.Aktiv;
                }
            }

            return _geduckt ? ErkennerStatus.Aktiv : ErkennerStatus.NichtAktiv;
        }
开发者ID:raphaelschmid,项目名称:finalproject,代码行数:40,代码来源:Ducken.cs


示例14: detectHighFives

        // Detect high fives between pairs of skeletons.
        private void detectHighFives(Skeleton[] skeletons)
        {
            // Loop over every pair of skeletons.
            for (int i = 0; i < skeletons.Length; i++)
            {
                for (int j = i + 1; j < skeletons.Length; j++)
                {
                    var skeleton1 = skeletons[i];
                    var skeleton2 = skeletons[j];
                    var id1 = skeleton1.TrackingId;
                    var id2 = skeleton2.TrackingId;

                    // Generate a key for the pair.
                    Tuple<int, int> key;
                    if (id1 < id2)
                        key = new Tuple<int, int>(id1, id2);
                    else
                        key = new Tuple<int, int>(id2, id1);

                    // Add the pair to the dictionary if it hasn't been seen before.
                    if (!hasHighFived.ContainsKey(key))
                        hasHighFived.Add(key, false);

                    // Check if the skeletons are high fiving at the moment.
                    bool currentHighFiveStatus = isHighFiving(skeleton1, skeleton2, hasHighFived[key]);

                    // Invoke the highFive method when a new high five has been detected.
                    if (!hasHighFived[key] && currentHighFiveStatus)
                        highFive();

                    // Save the current high five status.
                    hasHighFived[key] = currentHighFiveStatus;
                }
            }
        }
开发者ID:decrobin,项目名称:KinectwithDora,代码行数:36,代码来源:Kinect.cs


示例15: kinect_AllFramesReady

        void kinect_AllFramesReady( object sender, AllFramesReadyEventArgs e )
        {
            using ( var colorFrame = e.OpenColorImageFrame() ) {
                if ( colorFrame != null ) {
                    var pixel = new byte[colorFrame.PixelDataLength];
                    colorFrame.CopyPixelDataTo( pixel );

                    ImageRgb.Source = BitmapSource.Create( colorFrame.Width, colorFrame.Height, 96, 96,
                        PixelFormats.Bgr32, null, pixel, colorFrame.Width * 4 );
                }
            }

            using ( var depthFrame = e.OpenDepthImageFrame() ) {
                if ( depthFrame != null ) {
                    // Depth情報を入れる
                    // GetRawPixelData()はインタラクションライブラリ内で実装された拡張メソッド
                    stream.ProcessDepth( depthFrame.GetRawPixelData(), depthFrame.Timestamp );
                }
            }

            using ( var skeletonFrame = e.OpenSkeletonFrame() ) {
                if ( skeletonFrame != null ) {
                    var skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
                    skeletonFrame.CopySkeletonDataTo( skeletons );

                    // スケルトン情報を入れる
                    stream.ProcessSkeleton( skeletons, kinect.AccelerometerGetCurrentReading(), skeletonFrame.Timestamp );
                }
            }
        }
开发者ID:penyatree,项目名称:KinectSDKv17Sample,代码行数:30,代码来源:MainWindow.xaml.cs


示例16: CheckGesture

        public GesturePartResult CheckGesture(Skeleton skeleton)
        {

            double LeftA = Math.Sqrt((Math.Pow(skeleton.Joints[JointType.KneeLeft].Position.Z - skeleton.Joints[JointType.FootLeft].Position.Z, 2) + Math.Pow(skeleton.Joints[JointType.KneeLeft].Position.Y - skeleton.Joints[JointType.FootLeft].Position.Y, 2)));
            double LeftB = Math.Sqrt((Math.Pow(skeleton.Joints[JointType.HipRight].Position.Z - skeleton.Joints[JointType.KneeLeft].Position.Z, 2) + Math.Pow(skeleton.Joints[JointType.HipLeft].Position.Y - skeleton.Joints[JointType.KneeLeft].Position.Y, 2)));
            double LeftC = skeleton.Joints[JointType.HipLeft].Position.Y - skeleton.Joints[JointType.FootLeft].Position.Y;

            double RightA = Math.Sqrt((Math.Pow(skeleton.Joints[JointType.KneeRight].Position.Z - skeleton.Joints[JointType.FootRight].Position.Z, 2) + Math.Pow(skeleton.Joints[JointType.KneeRight].Position.Y - skeleton.Joints[JointType.FootRight].Position.Y, 2)));
            double RightB = Math.Sqrt((Math.Pow(skeleton.Joints[JointType.HipRight].Position.Z - skeleton.Joints[JointType.KneeRight].Position.Z, 2) + Math.Pow(skeleton.Joints[JointType.HipRight].Position.Y - skeleton.Joints[JointType.KneeRight].Position.Y, 2)));
            double RightC = skeleton.Joints[JointType.HipRight].Position.Y - skeleton.Joints[JointType.FootRight].Position.Y;

            double LeftAngle = Math.Acos((Math.Pow(LeftA, 2) + Math.Pow(LeftB, 2) - Math.Pow(LeftC, 2)) / (2 * LeftA * LeftB));
            double RightAngle = Math.Acos((Math.Pow(RightA, 2) + Math.Pow(RightB, 2) - Math.Pow(RightC, 2)) / (2 * RightA * RightB));

            LeftAngle = (LeftAngle * 180) / Math.PI;
            RightAngle = (RightAngle * 180) / Math.PI;
            if ((LeftAngle < 145 && RightAngle < 145))
            {
                return GesturePartResult.Succeed;
            }
            else if (LeftAngle < 170 && RightAngle < 170)
            {
                return GesturePartResult.Pausing;
            }       
                return GesturePartResult.Fail;
        }
开发者ID:guozanhua,项目名称:kinect-ripple,代码行数:26,代码来源:JumpSegment2.cs


示例17: KinectHelper

        public KinectHelper()
        {
            Skeletons=new Skeleton[0];
            NearestId = -1;

            InitializeNui();
            KinectSensor.KinectSensors.StatusChanged += (s, ee) =>
            {
                switch (ee.Status)
                {
                    case KinectStatus.Connected:
                        if (nui == null)
                        {
                            InitializeNui();
                        }
                        break;
                    default:
                        if (ee.Sensor == nui)
                        {
                            UninitializeNui();
                        }
                        break;
                }
            };
        }
开发者ID:jasine,项目名称:KinectExplorer,代码行数:25,代码来源:KinectHelper.cs


示例18: CheckGesture

        public GesturePartResult CheckGesture(Skeleton skeleton, GesturePartResult previousResult)
        {
            if (skeleton == null)
            {
                return GesturePartResult.Fail;
            }

            // right hand is raised but not swiping yet
            if (skeleton.Joints[JointType.HandRight].Position.Y > skeleton.Joints[JointType.ElbowRight].Position.Y)
            {

                // right hand is to the right of the elbow
                if (skeleton.Joints[JointType.HandRight].Position.X > skeleton.Joints[JointType.ElbowRight].Position.X)
                {
                    framecount = 0;
                    return GesturePartResult.Succeed;
                }

                if (previousResult == GesturePartResult.Succeed)
                {
                    framecount++;
                    if (framecount > 30)
                    {
                        framecount = 0;
                        return GesturePartResult.Fail;
                    }
                    return GesturePartResult.Pausing;
                }
            }

            // hand dropped
            return GesturePartResult.Fail;
        }
开发者ID:RITInsightLab,项目名称:space-adventure,代码行数:33,代码来源:SwipeLeftSegment2.cs


示例19: Timer_Elapsed

        static void Timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            var passive = 0;
            var active = 0;

            foreach(var k in KinectSensor.KinectSensors)
            {
                using(var frame = k.SkeletonStream.OpenNextFrame(50))
                {
                    if(frame != null)
                    {
                        var s = new Skeleton[frame.SkeletonArrayLength];
                        frame.CopySkeletonDataTo(s);
                        foreach (var skeleton in s)
                        {
                            if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
                                active++;

                            if (skeleton.TrackingState == SkeletonTrackingState.PositionOnly)
                                passive++;
                        }
                    }
                }

                Console.WriteLine(logic.Process(active, passive));
            }
        }
开发者ID:kchikuse,项目名称:kinect,代码行数:27,代码来源:Program.cs


示例20: CheckGesture

        public GesturePartResult CheckGesture(Skeleton skeleton)
        {
            if (skeleton != null)
            {
                // Right and Left Hand in front of Shoulders
                if (skeleton.Joints[JointType.HandLeft].Position.Z < skeleton.Joints[JointType.ElbowLeft].Position.Z && skeleton.Joints[JointType.HandRight].Position.Z < skeleton.Joints[JointType.ElbowRight].Position.Z)
                {
                    //Debug.WriteLine("Zoom 0 - Right hand in front of right shoudler - PASS");

                    // Hands between shoulder and hip
                    if (skeleton.Joints[JointType.HandRight].Position.Y < skeleton.Joints[JointType.ShoulderCenter].Position.Y && skeleton.Joints[JointType.HandRight].Position.Y > skeleton.Joints[JointType.HipCenter].Position.Y &&
                        skeleton.Joints[JointType.HandLeft].Position.Y < skeleton.Joints[JointType.ShoulderCenter].Position.Y && skeleton.Joints[JointType.HandLeft].Position.Y > skeleton.Joints[JointType.HipCenter].Position.Y)
                    {
                        // Hands between shoulders
                        if (skeleton.Joints[JointType.HandRight].Position.X < skeleton.Joints[JointType.ShoulderRight].Position.X && skeleton.Joints[JointType.HandRight].Position.X > skeleton.Joints[JointType.ShoulderLeft].Position.X &&
                            skeleton.Joints[JointType.HandLeft].Position.X > skeleton.Joints[JointType.ShoulderLeft].Position.X && skeleton.Joints[JointType.HandLeft].Position.X < skeleton.Joints[JointType.ShoulderRight].Position.X)
                        {
                            return GesturePartResult.Succeed;
                        }

                        return GesturePartResult.Pausing;
                    }

                    return GesturePartResult.Fail;
                }
            }

            return GesturePartResult.Fail;
        }
开发者ID:GeorgJung,项目名称:Impact,代码行数:29,代码来源:ZoomSegments.cs



注:本文中的Microsoft.Kinect.Skeleton类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Kinect.SkeletonFrameReadyEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Kinect.KinectSensor类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap