Beispiel #1
0
        public UserPresence()
        {
            gFI = new FacialInfo();
            gGM = new GroupManager();
            gCS = new ContentSelection();
            gGD = new GestureDetection();

            gElapsedTime = 0;
            gCVInterval = 0;
            gKinectInterval = 0;
            gGestureCooldownInterval = 0;
            gGestureCooldown = false;
        }
Beispiel #2
0
        public void UpdateInput(double Seconds, Image<Bgr, Byte> CVImage)
        {
            gElapsedTime += (int)Seconds;
            if (gElapsedTime > 5000)
                gElapsedTime = 0;

            gFI.QueryFrame(CVImage);

            gCVInterval += (int)Seconds;
            if (gCVInterval > 1000) // which means it will be at 600
                gCVInterval = 0;

            gKinectInterval += (int)Seconds;
            if (gKinectInterval > 200) 
                gKinectInterval = 0;

            if (gGestureCooldown)
            {
                gGestureCooldownInterval += (int)Seconds;
                if (gGestureCooldownInterval > 1000)
                {
                    gGestureCooldownInterval = 0;
                    gGestureCooldown = false;
                    gGD.gGestureEvent = GestureType.None;
                }
            }

            //User Management
            if (gCVInterval == 0)
            {
                List<String> UserIDs = DetectUsers();
                gGM.LoadUsers(UserIDs);
            }
            else
            {
                //FacialDetection();
            }
            if (gElapsedTime == 5000)
                if (gGM.ActiveUsers.Count == 0)
                    gCS = new ContentSelection();
            
            //Content Selection
            if ((gElapsedTime == 0) || (gElapsedTime == 2600))
            {
                if (gGM.ChangeInGroups)
                {
                    gCS.UpdateArtifacts(gGM);
                    gGM.ChangeInGroups = false;
                }
            }

            //Gesture Detection

            try
            {

                if (gKinectInterval == 0)
                {


                    if (!gGestureCooldown)
                    {
                        gGD.DetectGesture();

                        if (gGD.gGestureEvent.Equals(GestureType.RightSwipeNext) || gGD.gGestureEvent.Equals(GestureType.RightSwipeBack))
                            gGestureCooldown = true;
                    }
                }
            }
            catch { }

            
        }