Пример #1
0
        void userGenerator_LostUser(object sender, UserLostEventArgs e)
        {
            NiteKinectUserEventData eventdata = new NiteKinectUserEventData(new NiteKinectUserData(e.ID, NiteKinectUserState.Exited, new Point3D()));

            if (DataReceived != null)
            {
                DataReceived(this, new DataReceivedEventHandler()
                {
                    PluginData = eventdata
                });
            }
            //
            this.joints.Remove(e.ID);
        }
Пример #2
0
        void userGenerator_NewUser(object sender, NewUserEventArgs e)
        {
            NiteKinectUserEventData eventdata = new NiteKinectUserEventData(new NiteKinectUserData(e.ID, NiteKinectUserState.Entered, new Point3D()));

            if (DataReceived != null)
            {
                DataReceived(this, new DataReceivedEventHandler()
                {
                    PluginData = eventdata
                });
            }
            //
            this.poseDetectionCapability.StartPoseDetection(this.calibPose, e.ID);
        }
Пример #3
0
        private void ReaderThread()
        {
            while (this.shouldRun)
            {
                try
                {
                    this.context.WaitOneUpdateAll(this.depth);
                }
                catch (Exception)
                {
                }

                //lock (this)
                try
                {
                    int[] users = this.userGenerator.GetUsers();
                    foreach (int user in users)
                    {
                        Point3D com = this.userGenerator.GetCoM(user);
                        com = this.depth.ConvertRealWorldToProjective(com);
                        //
                        NiteKinectUserState state = NiteKinectUserState.Unknown;
                        if (this.skeletonCapbility.IsTracking(user))
                        {
                            state = NiteKinectUserState.Tracking;
                            //
                            updatejoints(user);
                            //
                            NiteKinectUserEventData eventdata = new NiteKinectUserEventData(new NiteKinectUserData(user, state, com)
                            {
                                UserSkelton = joints[user]
                            });
                            if (DataReceived != null)
                            {
                                DataReceived(this, new DataReceivedEventHandler()
                                {
                                    PluginData = eventdata
                                });
                            }
                        }
                        else
                        {
                            if (this.skeletonCapbility.IsCalibrating(user))
                            {
                                state = NiteKinectUserState.Calibrating;
                            }
                            else
                            {
                                state = NiteKinectUserState.LookingForPose;
                            }
                            //
                            NiteKinectUserEventData eventdata = new NiteKinectUserEventData(new NiteKinectUserData(user, state, com));
                            if (DataReceived != null)
                            {
                                DataReceived(this, new DataReceivedEventHandler()
                                {
                                    PluginData = eventdata
                                });
                            }
                        }
                    }
                }
                catch { }
            }
        }