public void StartDisplay(TravelOffer lastTravel) { _currentOffer = lastTravel; try { InitializeComponent(); InitList(); var helper = KinectHelper.Instance; helper.ReadyEvent += (s, _) => HelperReady(); GreenScreen.Start(helper.Sensor, false); SetNewHat(); Accessories.Start(helper.Sensor); RectNavigationControl.Start(helper.Sensor); RectNavigationControl.SwipeLeftEvent += SwipeLeft; RectNavigationControl.SwipeRightEvent += SwipeRight; RectNavigationControl.SwipeUpEvent += SwipeUp; RectNavigationControl.SwipeDownEvent += SwipeDown; RectNavigationControl.NoSwipe += NoSwipe; string[] texts = MyTextLoopList.GetNeighbourTexts(); RectNavigationControl.SetTopText(texts[0]); RectNavigationControl.SetBottomText(texts[1]); InitGenderDetection(); } catch (Exception exc) { ExceptionTextBlock.Text = exc.Message + "\r\n" + exc.InnerException + "\r\n" + exc.StackTrace; } }
private void StartGreenScreenAndHat() { var helper = KinectHelper.Instance; GreenScreen.Start(helper.Sensor, false);// TODO wieder auf true sonst kein antialiasing Accessories.AccessoryItems.Clear(); AccessoryItem hat = new AccessoryItem(AccessoryPositon.Hat, _currentOffer.Category.CategoryId, false); Accessories.AccessoryItems.Add(hat); Accessories.Start(helper.Sensor); helper.ReadyEvent += (s, _) => HelperReady(); }
/// <summary> /// Execute startup tasks /// </summary> /// <param name="sender">object sending the event</param> /// <param name="e">event arguments</param> private void WindowLoaded(object sender, RoutedEventArgs e) { // Look through all sensors and start the first connected one. // This requires that a Kinect is connected at the time of app startup. // To make your app robust against plug/unplug, // it is recommended to use KinectSensorChooser provided in Microsoft.Kinect.Toolkit foreach (var potentialSensor in KinectSensor.KinectSensors) { if (potentialSensor.Status == KinectStatus.Connected) { this.sensor = potentialSensor; break; } } if (null != this.sensor) { // Turn on the depth stream to receive depth frames this.sensor.DepthStream.Enable(DepthFormat); this.depthWidth = this.sensor.DepthStream.FrameWidth; this.depthHeight = this.sensor.DepthStream.FrameHeight; this.sensor.ColorStream.Enable(ColorFormat); int colorWidth = this.sensor.ColorStream.FrameWidth; int colorHeight = this.sensor.ColorStream.FrameHeight; this.colorToDepthDivisor = colorWidth / this.depthWidth; // Turn on to get player masks this.sensor.SkeletonStream.Enable(); // Allocate space to put the depth pixels we'll receive this.depthPixels = new DepthImagePixel[this.sensor.DepthStream.FramePixelDataLength]; // Allocate space to put the color pixels we'll create this.colorPixels = new byte[this.sensor.ColorStream.FramePixelDataLength]; this.greenScreenPixelData = new int[this.sensor.DepthStream.FramePixelDataLength]; this.colorCoordinates = new ColorImagePoint[this.sensor.DepthStream.FramePixelDataLength]; // This is the bitmap we'll display on-screen this.colorBitmap = new WriteableBitmap(colorWidth, colorHeight, 96.0, 96.0, PixelFormats.Bgr32, null); // Set the image we display to point to the bitmap where we'll put the image data //this.MaskedColor.Source = this.colorBitmap; // Add an event handler to be called whenever there is new depth frame data this.sensor.AllFramesReady += this.SensorAllFramesReady; GreenScreen.Start(sensor, false); // Start the sensor! try { this.sensor.Start(); } catch (IOException) { this.sensor = null; Console.WriteLine("Error Antialiasing"); } } if (null == this.sensor) { this.statusBarText.Text = Properties.Resources.NoKinectReady; } }