當前位置: 首頁>>代碼示例>>C#>>正文


C# BodyFrameArrivedEventArgs類代碼示例

本文整理匯總了C#中BodyFrameArrivedEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# BodyFrameArrivedEventArgs類的具體用法?C# BodyFrameArrivedEventArgs怎麽用?C# BodyFrameArrivedEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BodyFrameArrivedEventArgs類屬於命名空間,在下文中一共展示了BodyFrameArrivedEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Calibration_FrameArrived

        private void Calibration_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            kc.Controller_FrameArrived(sender, e);

            if (kc.Arm != ArmPointing.Nothing)
            {
                float pointedX = kc.GetPointedX();
                float pointedY = kc.GetPointedY();

                DataLog.Log(DataLog.DebugLevel.Message, "Calibrated with X=" + pointedX.ToString() +
                    " Y=" + pointedY.ToString());

                if (!File.Exists(OPT_FILE))
                    File.Create(OPT_FILE).Close();

                List<float> l = new List<float>();

                l.Add(pointedX);
                l.Add(pointedY);

                StreamWriter cal_file = File.CreateText(OPT_FILE);
                JsonTextWriter cal_writer = new JsonTextWriter(cal_file);
                string data = JsonConvert.SerializeObject(l);
                cal_writer.WriteRaw(data);
                cal_file.Close();

                this.Close();
            }
        }
開發者ID:NoMore201,項目名稱:InteractiveMediaWindow,代碼行數:29,代碼來源:CalibrationWindow.xaml.cs

示例2: Reader_FrameArrived

        public void Reader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            bool dataReceived = false;
            Body[] bodies = null;

            using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame())
            {
                if (bodyFrame != null)
                {
                    bodies = new Body[bodyFrame.BodyCount];

                    bodyFrame.GetAndRefreshBodyData(bodies);
                    dataReceived = true;
                }
            }

            if (dataReceived)
            {
                foreach (Body body in bodies)
                {
                    gestureCollectionManager.DetectGestures(body);
                    //BasicHandGesture(body);
                }
            }
        }
開發者ID:becker-portilla,項目名稱:KinectPowerPointControl,代碼行數:25,代碼來源:KinectHandler.cs

示例3: Reader_FrameArrived

        public void Reader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            kc.Controller_FrameArrived(sender, e);

            // Fill all text boxes
            FillBoxes();

            arm.Text = kc.Arm.ToString();
            if (kc.Arm == ArmPointing.Right)
            {
                float pointedX = kc.GetPointedX();
                float pointedY = kc.GetPointedY();

                pointedPoint.Text = "X= " + pointedX.ToString() + "\nY= " + pointedY.ToString();
                zoneBox.Text = kc.GetPointedZone().ToString();
            }
            else if (kc.Arm == ArmPointing.Left)
            {
                float pointedX = kc.GetPointedX();
                float pointedY = kc.GetPointedY();

                pointedPoint.Text = "X= " + pointedX.ToString() + "\nY= " + pointedY.ToString();
                zoneBox.Text = kc.GetPointedZone().ToString();
            }
            else
            {
                this.pointedPoint.Text = "notPointing";
                zoneBox.Text = "0";
            }
        }
開發者ID:NoMore201,項目名稱:InteractiveMediaWindow,代碼行數:30,代碼來源:MainWindow.xaml.cs

示例4: BodyFrame_Arrived

        void BodyFrame_Arrived(object sender, BodyFrameArrivedEventArgs e)
        {
            var frameReference = e.FrameReference;

            if (frameReference == null)
                return;

            var frame = frameReference.AcquireFrame();

            if (frame == null)
                return;

            using (frame) {
                frame.GetAndRefreshBodyData(bodies);

                using (var dc = drawingGroup.Open()) {
                    dc.DrawRectangle(Brushes.Transparent, null, new Rect(0.0, 0.0, colorSpaceWidth, colorSpaceHeight));

                    foreach (var body in bodies) {
                        if (body.IsTracked) {
                            var rShoulder = body.Joints[JointType.ShoulderRight];
                            var rElbow = body.Joints[JointType.ElbowRight];
                            var rWrist = body.Joints[JointType.HandRight];

                            DrawBone(rShoulder, rElbow, dc);
                            DrawBone(rElbow, rWrist, dc);

                            UpdateAngle(rShoulder, rElbow, rWrist);
                        }
                    }
                }
            }
        }
開發者ID:RMonaco,項目名稱:RomDemo,代碼行數:33,代碼來源:MainWindow.xaml.cs

示例5: UpdateBodyFrame

        // ボディの更新
        private void UpdateBodyFrame( BodyFrameArrivedEventArgs e )
        {
            using ( var bodyFrame = e.FrameReference.AcquireFrame() ) {
                if ( bodyFrame == null ) {
                    return;
                }

                // ボディデータを取得する
                bodyFrame.GetAndRefreshBodyData( bodies );
            }
        }
開發者ID:kaorun55,項目名稱:Kinect-for-Windows-SDK-v2.0-Samples,代碼行數:12,代碼來源:MainWindow.xaml.cs

示例6: BodyReader_FrameArrived

        private void BodyReader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            using (var bodyFrame = e.FrameReference.AcquireFrame())
            {
                if (bodyFrame != null)
                {
                    bodyFrame.GetAndRefreshBodyData(_bodies);

                    _body = _bodies.Where(b => b.IsTracked).FirstOrDefault();
                }
            }
        }
開發者ID:guozanhua,項目名稱:Kinect-Finger-Tracking,代碼行數:12,代碼來源:MainWindow.xaml.cs

示例7: bosyReader_FrameArrived

 void bosyReader_FrameArrived( object sender, BodyFrameArrivedEventArgs e )
 {
     try {
         using ( var bodyFrame = e.FrameReference.AcquireFrame() ) {
             if ( bodyFrame != null ) {
                 ShowBody( bodyFrame );
             }
         }
     }
     catch ( Exception ex ) {
         Trace.WriteLine( ex.Message );
     }
 }
開發者ID:kaorun55,項目名稱:Kinect22Scratch,代碼行數:13,代碼來源:MainWindow.xaml.cs

示例8: Reader_BodyFrameArrived

        private void Reader_BodyFrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            if (recordMode != RecordMode.Playingback)
            {
                bool dataReceived = false;
                Body[] tempo = null;

                using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame())
                {
                    if (bodyFrame != null)
                    {
                        if (this.recordingBodies == null)
                        {
                            this.recordingBodies = new Body[bodyFrame.BodyCount];
                        }
                        tempo = new Body[bodyFrame.BodyCount];

                        // The first time GetAndRefreshBodyData is called, Kinect will allocate each Body in the array.
                        // As long as those body objects are not disposed and not set to null in the array,
                        // those body objects will be re-used.
                        bodyFrame.GetAndRefreshBodyData(this.recordingBodies);
                        bodyFrame.GetAndRefreshBodyData(tempo);

                        dataReceived = true;
                    }
                }

                if (dataReceived)
                {
                    rgbBoard.Invalidate();
                    if (recordMode == RecordMode.Recording && this.rigWriter != null)
                    {
                        if (tmspStartRecording.HasValue)
                        {
                            // Save a copy of rig for later replay
                            
                            recordedRigs.Add(tempo.Where(body => body.IsTracked).ToArray());

                            var currentTime = DateTime.Now.TimeOfDay;
                            TimeSpan elapse = currentTime - tmspStartRecording.Value;
                            recordedRigTimePoints.Add((int)elapse.TotalMilliseconds);

                            WriteRig(elapse);
                        }
                    }
                }
            }
        }
開發者ID:tuandnvn,項目名稱:ecat,代碼行數:48,代碼來源:RecordPanel.Control.RecordRig.cs

示例9: FrameArrived

 public void FrameArrived(object sender, BodyFrameArrivedEventArgs e)
 {
     try
     {
         using (var frame = e.FrameReference.AcquireFrame())
         {
             if (frame == null) return;
             frame.GetAndRefreshBodyData(Bodies);
         }
         AnalyzeNewBodyData();
     }
     catch (Exception ex)
     {
         Logger.ErrorFormat("An error occured during processing of gesture: {0}", ex.Message);
     }
 }
開發者ID:jansaris,項目名稱:KinectV2,代碼行數:16,代碼來源:GestureBase.cs

示例10: FrameArrived

        private void FrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            var frame = e.FrameReference.AcquireFrame();
            if (frame != null)
            {
                frame.GetAndRefreshBodyData(this.bodies);
                frame.Dispose();

                KinectBody[] newFrame = this.bodies.Select(body => new KinectBody(body)).ToArray();

                if (this.FrameReceived != null)
                {
                    this.FrameReceived(this, new KinectBodyFrameDataEventArgs(newFrame));
                }
            }
        }
開發者ID:semihguresci,項目名稱:kgp,代碼行數:16,代碼來源:KinectSensorBodyFrameProvider.cs

示例11: BodyFrameReaderOnFrameArrived

        private void BodyFrameReaderOnFrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            bool dataReceived = false;

            using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame())
            {
                if (bodyFrame != null)
                {
                    if (this.bodies == null)
                    {
                        // creates an array of 6 bodies, which is the max number of bodies that Kinect can track simultaneously
                        this.bodies = new Body[bodyFrame.BodyCount];
                    }

                    // The first time GetAndRefreshBodyData is called, Kinect will allocate each Body in the array.
                    // As long as those body objects are not disposed and not set to null in the array,
                    // those body objects will be re-used.
                    bodyFrame.GetAndRefreshBodyData(this.bodies);
                    dataReceived = true;
                }
            }

            if (dataReceived)
            {
                // we may have lost/acquired bodies, so update the corresponding gesture detectors
                if (this.bodies != null)
                {
                    // loop through all bodies to see if any of the gesture detectors need to be updated
                    int maxBodies = this.kinectSensor.BodyFrameSource.BodyCount;
                    for (int i = 0; i < maxBodies; ++i)
                    {
                        Body body = this.bodies[i];
                        ulong trackingId = body.TrackingId;

                        // if the current body TrackingId changed, update the corresponding gesture detector with the new value
                        if (trackingId != this.gestureDetectorList[i].TrackingId)
                        {
                            this.gestureDetectorList[i].TrackingId = trackingId;

                            // if the current body is tracked, unpause its detector to get VisualGestureBuilderFrameArrived events
                            // if the current body is not tracked, pause its detector so we don't waste resources trying to get invalid gesture results
                            this.gestureDetectorList[i].IsPaused = trackingId == 0;
                        }
                    }
                }
            }
        }
開發者ID:Nimrodxx,項目名稱:InteractiveWall,代碼行數:47,代碼來源:MainWindow.xaml.cs

示例12: BodyReader_FrameArrived

        void BodyReader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            using (var frame = e.FrameReference.AcquireFrame())
            {
                if (frame != null)
                {
                    frame.GetAndRefreshBodyData(_bodies);

                    Body body = _bodies.Where(b => b != null && b.IsTracked).FirstOrDefault();

                    if (body != null)
                    {
                        _recorder.Update(body);
                    }
                }
            }
        }
開發者ID:pmargreff,項目名稱:Kinect-2-CSV,代碼行數:17,代碼來源:MainWindow.xaml.cs

示例13: bfr_FrameArrived

        private void bfr_FrameArrived(object o, BodyFrameArrivedEventArgs args)
        {
            using (var bodyFrame = args.FrameReference.AcquireFrame())
            {
                if (bodyFrame == null)
                {
                    return;
                }

                bodyFrame.GetAndRefreshBodyData(bodies);
                bodyCanvas.Children.Clear();
                engagerCanvas.Children.Clear();

                foreach (var body in Bodies)
                {
                    if (!eManager.users.Contains(body))
                    {
                        eManager.users.Add(body);
                    }

                    // Multithreading maybe
                    drawer.CurrentCanvas = bodyCanvas;
                    drawer.drawSkeleton(body);
                }

                if (!eManager.IsEngage)
                {
                    return;
                }

                eTracker.Engager = eManager.Engager;

                // Multithreading maybe
                drawer.CurrentCanvas = engagerCanvas;
                eManager.IsEngage = drawer.drawSkeleton(eTracker);

                if (eManager.DisablingEngagement)
                {
                    return;
                }
                var recognisedGestures = recogniser.recognise();

                man.reactGesture(recognisedGestures);
            }
        }
開發者ID:ThisIsLeoZhao,項目名稱:Graduation-Project,代碼行數:45,代碼來源:MainWindow.xaml.cs

示例14: BodyReader_FrameArrived

        private void BodyReader_FrameArrived(object sender, BodyFrameArrivedEventArgs args)
        {
            bool gotData = false;

            using (var frame = args.FrameReference.AcquireFrame())
            {
                if (frame != null)
                {
                    frame.GetAndRefreshBodyData(bodies);
                    gotData = true;
                }
            }

            if (gotData && !stopped)
            {
                this.TrackEngagedPlayersViaHandOverHead();
            }
        }
開發者ID:Jonathan1,項目名稱:MasterThesis-PresentationTrainer,代碼行數:18,代碼來源:HandOverheadEngagementModel.cs

示例15: Reader_BodyFrameArrived

        private void Reader_BodyFrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            using(BodyFrame frame = e.FrameReference.AcquireFrame())
            {
                if (frame != null)
                {
                    Vector4 temp = frame.FloorClipPlane;

                    if (((temp.X - up.X) * (temp.X - up.X) + (temp.Y - up.Y) * (temp.Y - up.Y)
                        + (temp.Z - up.Z) * (temp.Z - up.Z)) > .1)
                    {
                        this.needsCal = true;
                    }

                    up = temp;
                }
            }
        }
開發者ID:njpanzarino,項目名稱:Kinect,代碼行數:18,代碼來源:MainWindow.xaml.cs


注:本文中的BodyFrameArrivedEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。