/// <summary> /// Event handler for Kinect sensor's SkeletonFrameReady event /// </summary> /// <param name="sender">object sending the event</param> /// <param name="e">event arguments</param> private void SensorSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { Skeleton[] skeletons = new Skeleton[0]; using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame()) { if (skeletonFrame != null) { skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength]; skeletonFrame.CopySkeletonDataTo(skeletons); } } peopleDetector.TrackSkeletons(skeletons); this.LblErkanntOutput.Content = peopleDetector.GetPositionOnlyPeople().Count; this.LblTrackedOutput.Content = peopleDetector.GetTrackedPeople().Count; this.LblLaufenOutput.Content = peopleDetector.GetWalkingPeople().Count; this.LblStehenOutput.Content = peopleDetector.GetStayingPeople().Count; this.LblSchauenOutput.Content = peopleDetector.GetLookingPeople().Count; }
private void ChangeScreen() { #region debug keys effect if (_debugOnlyScreen2) { if (_currentScreen != ScreenMode.Walk) { StartWalkScreen(); } return; } if (_debugOnlyScreen3) { if (_currentScreen != ScreenMode.MainScreen) { StartMainScreen(); } return; } if (_debugOnlyScreen1) { if (_currentScreen != ScreenMode.Splash) { StartSplashScreen(); } return; } #endregion debug keys effect _walkingPeople = _peopleDetector.GetWalkingPeople().Count; _positionOnlyPeople = _peopleDetector.GetPositionOnlyPeople().Count; _trackedPeople = _peopleDetector.GetTrackedPeople().Count; _lookingPeople = _peopleDetector.GetLookingPeople().Count; _standingPeople = _peopleDetector.GetStayingPeople().Count; if (_currentScreen == ScreenMode.MainScreen && _mainWindow.IsGame()) { return; } if (_positionOnlyPeople == 0 && _trackedPeople == 0) //Zustand 1 { AddToBuffer(ScreenMode.Splash); if (_currentScreen != ScreenMode.Splash && MostBufferedScreen() == ScreenMode.Splash) { StartSplashScreen(); } } else // Zustand 2-4 { if (_standingPeople == 0 && _walkingPeople != 0 && _lookingPeople == 0) // Zustand 2 { AddToBuffer(ScreenMode.Walk); if (_currentScreen != ScreenMode.Walk && MostBufferedScreen() == ScreenMode.Walk) { StartWalkScreen(); } } else if (_standingPeople != 0 && _lookingPeople != 0) // Zustand 3 { AddToBuffer(ScreenMode.MainScreen); if (_currentScreen != ScreenMode.MainScreen && MostBufferedScreen() == ScreenMode.MainScreen) { StartMainScreen(); } } } }