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

C# BodyFrameArrivedEventArgs类代码示例

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

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



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


示例16: bodyFrameReader_FrameArrived

        private static void bodyFrameReader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            //throw new NotImplementedException();
            bool dataReceived = false;

            using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame())
            {
                if (bodyFrame != null)
                {
                    if (bodies == null)
                    {
                        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(bodies);
                    dataReceived = true;
                }
            }

            if (dataReceived)
            {

                foreach (var client in clients)
                {

                    var users = bodies.Where(s => s.IsTracked.Equals(true)).ToList();

                    if (users.Count>0){
                        string json = users.Serialize(_coordinateMapper, _mode);

                        Console.WriteLine("jsonstring: " + json);
                        Console.WriteLine("After body serialization and to send");

                        client.Send(json);
                    }

                }
            }
        }
开发者ID:kevinzhang96,项目名称:kinect-hand-bpm,代码行数:43,代码来源:Program.cs


示例17: bfr_FrameArrived

        void bfr_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            //Check to see if VGB has a valid tracking id, if not find a new body to track
            if (!pgfs.IsTrackingIdValid)
            {

                using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame())
                {
                    if (bodyFrame != null)
                    {
                        Body[] bodies = new Body[6];
                        bodyFrame.GetAndRefreshBodyData(bodies);
                        Body closestBody = null;
                        //iterate through the bodies and pick the one closest to the camera
                        foreach (Body b in bodies)
                        {
                            if (b.IsTracked)
                            {
                                if (closestBody == null)
                                {
                                    closestBody = b;
                                }
                                else
                                {
                                    Joint newHeadJoint = b.Joints[Microsoft.Kinect.JointType.Head];
                                    Joint oldHeadJoint = closestBody.Joints[Microsoft.Kinect.JointType.Head];
                                    if (newHeadJoint.TrackingState == TrackingState.Tracked && newHeadJoint.Position.Z < oldHeadJoint.Position.Z)
                                    {
                                        closestBody = b;
                                    }
                                }
                            }
                        }

                        //if we found a tracked body, update the trackingid for vgb
                        if (closestBody != null)
                        {
                            pgfs.TrackingId = closestBody.TrackingId;
                        }
                    }
                }
            }
        }
开发者ID:caomw,项目名称:prepose,代码行数:43,代码来源:Program.cs


示例18: BodyReader_FrameArrived

        private 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.IsTracked).FirstOrDefault();

                    if (!_faceSource.IsTrackingIdValid)
                    {
                        if (body != null)
                        {
                            // Assign a tracking ID to the face source
                            _faceSource.TrackingId = body.TrackingId;
                        }
                    }
                }
            }
        }
开发者ID:pghdotnet,项目名称:OxfordFace,代码行数:21,代码来源:MainWindow.xaml.cs


示例19: BodyReader_FrameArrived

        private void BodyReader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            using (var frame = e.FrameReference.AcquireFrame())
            {
                if (frame != null)
                {
                    Body[] bodies = new Body[frame.BodyCount];
                    frame.GetAndRefreshBodyData(bodies);

                    Body body = bodies.Where(b => b.IsTracked).FirstOrDefault();

                    if (!_faceSource.IsTrackingIdValid)
                    {
                        if (body != null)
                        {
                            _faceSource.TrackingId = body.TrackingId;
                        }
                    }
                }
            }
        }
开发者ID:ReallyRad,项目名称:kinect-2-face-hd,代码行数:21,代码来源:MainWindow.xaml.cs


示例20: OnBodyFrameArrived

        private void OnBodyFrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            using (var bodyFrame = e.FrameReference.AcquireFrame())
            {
                if (bodyFrame == null) return;

                bodyFrame.GetAndRefreshBodyData(_bodies);

                foreach (var body in _bodies.Where(b => b.IsTracked && !_scans.ContainsKey(b.TrackingId)))
                {
                    var gestureScan = new GestureScan(_kinectSensor, body.TrackingId, _visualGestureBuilderDatabase);

                    gestureScan.Next += OnNext;
                    gestureScan.Previous += OnPrevious;
                    gestureScan.TakeControl += OnTakeControl;
                    gestureScan.TrackingIdLost += OnTrackingIdLost;
                    gestureScan.End += OnEnd;

                    _scans.TryAdd(body.TrackingId, gestureScan);
                }
            }
        }
开发者ID:andreasassetti,项目名称:Kinect-v2-PowerPointAddIn,代码行数:22,代码来源:GestureManager.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# BodyFrameReader类代码示例发布时间:2022-05-24
下一篇:
C# Body类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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