private void InitKinect() { Size displaySize = new Size(0, 0); this.kinectSensor = KinectSensor.GetDefault(); if (this.kinectSensor != null) { this.kinectSensor.Open(); var frameDescription = this.kinectSensor.DepthFrameSource.FrameDescription; displaySize.Width = frameDescription.Width; displaySize.Height = frameDescription.Height; this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader(); this.UptimeText = Properties.Resources.InitializingStatusTextFormat; } else { this.UptimeText = Properties.Resources.NoSensorFoundText; } this.kinectCanvas = new KinectCanvas(this.kinectSensor, displaySize); }
// the method gets the location(latitude and longitude) on map based on where the kinect hand (preferrably right hand) is pointing at the map. private Microsoft.Maps.MapControl.WPF.Location getLocationFromScreenPoint() { Microsoft.Maps.MapControl.WPF.Location l = null; this.Dispatcher.Invoke(() => { System.Windows.Point mapPoint = KinectCanvas.TranslatePoint(kinectHandPositionOnScreen, myMap); // Due to some alignment problem, the Y coordinate is shifted (Open Issue: need to figure out the problem). Hence this offset tries to place the point exactly on the kinect hand position mapPoint.Y = mapPoint.Y - StaticVariables.handPointOffsetY; l = myMap.ViewportPointToLocation(mapPoint); }); return(l); }
// the method adds a pushpin at the location of the kinect hand position (preferrably right hand) // the kinectHandPositionOnScreen has a default value of 0,0. It gets updated based on hand position. private void ShowLocationOfKinectHandPoint() { // The kinectHandPositionOnScreen gives coordinates relative to the UIElement on which kinect hands are drawn which in this case is 'KinectCanvas'. // This coordinates needs to translated relative to the Map UIElement to find out the location. System.Windows.Point mapPoint = KinectCanvas.TranslatePoint(kinectHandPositionOnScreen, myMap); // Due to some alignment problem, the Y coordinate is shifted (Open Issue: need to figure out the problem). Hence this offset tries to place the point exactly on the kinect hand position mapPoint.Y = mapPoint.Y - StaticVariables.handPointOffsetY; Microsoft.Maps.MapControl.WPF.Location l = myMap.ViewportPointToLocation(mapPoint); Pushpin pushpin = new Pushpin(); pushpin.Location = l; myMap.Children.Add(pushpin); }
private void InitKinect() { Size displaySize = new Size(0, 0); this.kinectSensor = KinectSensor.GetDefault(); if (this.kinectSensor != null) { this.kinectSensor.Open(); var frameDescription = this.kinectSensor.DepthFrameSource.FrameDescription; displaySize.Width = frameDescription.Width; displaySize.Height = frameDescription.Height; gestureDatabase = new VisualGestureBuilderDatabase(@"../../../Gestures/gestures.gbd"); gestureFrameSource = new VisualGestureBuilderFrameSource(this.kinectSensor, 0); this.discreteGestures = new List <Gesture>(); this.continuousGestures = new List <Gesture>(); foreach (Gesture gesture in gestureDatabase.AvailableGestures) { if (gesture.GestureType == GestureType.Discrete) { this.discreteGestures.Add(gesture); } else if (gesture.GestureType == GestureType.Continuous) { this.continuousGestures.Add(gesture); } this.gestureFrameSource.AddGesture(gesture); } this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader(); this.gestureFrameReader = gestureFrameSource.OpenReader(); this.gestureFrameReader.IsPaused = true; this.gestureFrameReader.FrameArrived += gestureFrameReader_FrameArrived; this.UptimeText = Properties.Resources.InitializingStatusTextFormat; } else { this.UptimeText = Properties.Resources.NoSensorFoundText; } this.kinectCanvas = new KinectCanvas(this.kinectSensor, displaySize); }
private void InitKinect() { Size displaySize = new Size(0, 0); this.kinectSensor = KinectSensor.GetDefault(); if (this.kinectSensor != null) { this.kinectSensor.Open(); var frameDescription = this.kinectSensor.DepthFrameSource.FrameDescription; displaySize.Width= frameDescription.Width; displaySize.Height = frameDescription.Height; gestureDatabase = new VisualGestureBuilderDatabase(@"../../../Gestures/gestures.gbd"); gestureFrameSource = new VisualGestureBuilderFrameSource(this.kinectSensor, 0); this.discreteGestures = new List<Gesture>(); this.continuousGestures = new List<Gesture>(); foreach (Gesture gesture in gestureDatabase.AvailableGestures) { if (gesture.GestureType == GestureType.Discrete) { this.discreteGestures.Add(gesture); } else if (gesture.GestureType == GestureType.Continuous) { this.continuousGestures.Add(gesture); } this.gestureFrameSource.AddGesture(gesture); } this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader(); this.gestureFrameReader = gestureFrameSource.OpenReader(); this.gestureFrameReader.IsPaused =true; this.gestureFrameReader.FrameArrived += gestureFrameReader_FrameArrived; this.UptimeText = Properties.Resources.InitializingStatusTextFormat; } else { this.UptimeText = Properties.Resources.NoSensorFoundText; } this.kinectCanvas = new KinectCanvas(this.kinectSensor, displaySize); }
private void InitKinect() { Size displaySize = new Size(0, 0); this.kinectSensor = KinectSensor.GetDefault(); if (this.kinectSensor != null) { this.kinectSensor.Open(); var frameDescription = this.kinectSensor.DepthFrameSource.FrameDescription; displaySize.Width= frameDescription.Width; displaySize.Height = frameDescription.Height; this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader(); this.UptimeText = Properties.Resources.InitializingStatusTextFormat; } else { this.UptimeText = Properties.Resources.NoSensorFoundText; } this.kinectCanvas = new KinectCanvas(this.kinectSensor, displaySize); }