当前位置: 首页>>代码示例>>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;未经允许,请勿转载。