//private AlgorithmicPostureDetector AlgorithmicPostureDetector; public SensorMouse() { SwipeGestureDetectorL = new SwipeGestureDetector(); SwipeGestureDetectorR = new SwipeGestureDetector(); SwipeGestureDetectorR.SwipeMininalDuration = 200; SwipeGestureDetectorL.SwipeMininalDuration = 200; SwipeGestureDetectorR.SwipeMaximalDuration = 250; SwipeGestureDetectorL.SwipeMaximalDuration = 250; SwipeGestureDetectorR.MinimalPeriodBetweenGestures = 600; SwipeGestureDetectorL.MinimalPeriodBetweenGestures = 600; //AlgorithmicPostureDetector = new AlgorithmicPostureDetector(); //AlgorithmicPostureDetector.Epsilon = 0.15f; }
private void Initialize() { if (_kinectSensor == null) return; _gestureDetector = new SwipeGestureDetector {DisplayCanvas = SkeletonCanvas, DisplayColor = Colors.Crimson}; _gestureDetector.OnGestureDetected += OnGestureDetected; _postureDetector = new AlgorithmicPostureDetector(); _postureDetector.PostureDetected += OnPostureDetected; _ellipses = new Dictionary<JointType, Ellipse>(); _kinectSensor.AllFramesReady += KinectSensorAllFramesReady; _kinectSensor.SkeletonStream.Enable(); _kinectSensor.Start(); Message = "Kinect connected"; }
public KinectListener() { this.circleTemplate = Path.Combine(Environment.CurrentDirectory, "circle.tpl"); this.swipe = new SwipeGestureDetector(); this.swipe.OnGestureDetected += Swipe_OnGestureDetected; this.posture = new AlgorithmicPostureDetector(); this.posture.PostureDetected += Posture_PostureDetected; using (Stream stream = File.Open(this.circleTemplate, FileMode.OpenOrCreate)) { this.circle = new TemplatedGestureDetector("Circle", stream); this.circle.OnGestureDetected += Circle_OnGestureDetected; } }
//Initialize method is called when a Kinect sensor is connected private void Initialize() { if (kinectSensor == null) return; //The beam angle is simply displayed by the AudioStreamManager: audioManager = new AudioStreamManager(kinectSensor.AudioSource); audioBeamAngle.DataContext = audioManager; kinectSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30); kinectSensor.ColorFrameReady += kinectRuntime_ColorFrameReady; kinectSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30); kinectSensor.DepthFrameReady += kinectSensor_DepthFrameReady; kinectSensor.SkeletonStream.Enable(new TransformSmoothParameters { Smoothing = 0.5f, Correction = 0.5f, Prediction = 0.5f, JitterRadius = 0.05f, MaxDeviationRadius = 0.04f }); kinectSensor.SkeletonFrameReady += kinectRuntime_SkeletonFrameReady; swipeGestureRecognizer = new SwipeGestureDetector(); swipeGestureRecognizer.OnGestureDetected += OnGestureDetected; skeletonDisplayManager = new SkeletonDisplayManager(kinectSensor, kinectCanvas); kinectSensor.Start(); LoadGestureDetector(); LoadLetterTPostureDetector(); nuiCamera = new BindableNUICamera(kinectSensor); elevationSlider.DataContext = nuiCamera; voiceCommander = new VoiceCommander("record", "stop"); voiceCommander.OrderDetected += voiceCommander_OrderDetected; StartVoiceCommander(); kinectDisplay.DataContext = colorManager; dingPlayer = new SoundPlayer("ding.wav"); // Load sound }
private void Window_Loaded(object sender, RoutedEventArgs e) { gerenciadorDoKinect = new GerenciadorDoKinect(); SensorChooserUI.KinectSensorChooser = gerenciadorDoKinect.SensorChooser; gerenciadorDoKinect.KinectAlterado += gerenciadorDoKinect_KinectAlterado; slideShow = new SlideShow(); ProximaImagem(); detectorDeGestosMaoDireita = new SwipeGestureDetector(); detectorDeGestosMaoEsquerda = new SwipeGestureDetector(); detectorDeGestosMaoDireita.OnGestureDetected += DetectorDeGestos_GestureDetected; detectorDeGestosMaoEsquerda.OnGestureDetected += DetectorDeGestos_GestureDetected; contextTracker = new ContextTracker(); detectorDeAceno = new AlgorithmicPostureDetector(); detectorDeAceno.PostureDetected += detectorDeAceno_PostureDetected; indicadorDeAtividade.Ativo = false; }
// Gestures private void InitializeGestures() { swipeGestureRecognizer = new SwipeGestureDetector(); swipeGestureRecognizer.OnGestureDetected += OnGestureDetected; using (Stream recordStream = File.Open("../../circleKB.save", FileMode.Open)) { circleGestureRecognizer = new TemplatedGestureDetector("Circle", recordStream); circleGestureRecognizer.OnGestureDetected += OnGestureDetected; } }
/// <summary> /// Called at the start when the window is loaded /// </summary> private void InitializeKinect() { using (Stream recordStream = File.Open(@"circleKB.save", FileMode.OpenOrCreate)) { this.circleDetector = new TemplatedGestureDetector("Circle", recordStream); this.circleDetector.DisplayCanvas = videoCanvas; this.circleDetector.OnGestureDetected += OnHandGesture; } this.gestureDetector = new SwipeGestureDetector(); this.gestureDetector.DisplayCanvas = videoCanvas; this.gestureDetector.OnGestureDetected += OnHandGesture; ParallelCombinedGestureDetector parallelCombinedGestureDetector = new ParallelCombinedGestureDetector(); parallelCombinedGestureDetector.OnGestureDetected += OnHandGesture; parallelCombinedGestureDetector.DisplayCanvas = videoCanvas; parallelCombinedGestureDetector.Add(circleDetector); parallelCombinedGestureDetector.Add(gestureDetector); foreach (var potentialSensor in KinectSensor.KinectSensors) { if (potentialSensor.Status == KinectStatus.Connected) { this.kinectSensor = potentialSensor; break; } } if (null != this.kinectSensor) { // Turning on skeleton stream this.kinectSensor.SkeletonStream.Enable(); this.kinectSensor.SkeletonFrameReady += this.SensorSkeletonFrameReady; // Turn on the color stream to receive color frames this.kinectSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30); // Allocate space to put the pixels we'll receive this.colorPixels = new byte[this.kinectSensor.ColorStream.FramePixelDataLength]; // This is the bitmap we'll display on-screen this.colorBitmap = new WriteableBitmap(this.kinectSensor.ColorStream.FrameWidth, this.kinectSensor.ColorStream.FrameHeight, 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.Image.Source = this.colorBitmap; // Add an event handler to be called whenever there is new color frame data this.kinectSensor.ColorFrameReady += this.SensorColorFrameReady; this.kinectSensor.Start(); } if (null == this.kinectSensor) { // Connection is failed return; } this.speech = new Speech(this.kinectSensor, grammar, this); this.speech.Start(); }
private void Initialize() { if (kinectSensor == null) return; audioManager = new AudioStreamManager(kinectSensor.AudioSource); audioBeamAngle.DataContext = audioManager; kinectSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30); kinectSensor.ColorFrameReady += kinectRuntime_ColorFrameReady; kinectSensor.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30); kinectSensor.DepthFrameReady += kinectSensor_DepthFrameReady; kinectSensor.SkeletonStream.Enable(new TransformSmoothParameters { Smoothing = 0.5f, Correction = 0.5f, Prediction = 0.5f, JitterRadius = 0.05f, MaxDeviationRadius = 0.04f }); kinectSensor.SkeletonFrameReady += kinectRuntime_SkeletonFrameReady; swipeGestureRecognizer = new SwipeGestureDetector(); swipeGestureRecognizer.OnGestureDetected += OnGestureDetected; skeletonDisplayManager = new SkeletonDisplayManager(kinectSensor, kinectCanvas); kinectSensor.Start(); LoadCircleGestureDetector(); LoadLetterTPostureDetector(); nuiCamera = new BindableNUICamera(kinectSensor); elevationSlider.DataContext = nuiCamera; voiceCommander = new VoiceCommander("record", "stop"); voiceCommander.OrderDetected += voiceCommander_OrderDetected; StartVoiceCommander(); kinectDisplay.DataContext = colorManager; parallelCombinedGestureDetector = new ParallelCombinedGestureDetector(); parallelCombinedGestureDetector.OnGestureDetected += OnGestureDetected; parallelCombinedGestureDetector.Add(swipeGestureRecognizer); parallelCombinedGestureDetector.Add(circleGestureRecognizer); MouseController.Current.DisableGestureClick = false; // kinectSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated; }
void sb_Completed(object sender, EventArgs e) { // Init Kinect try { kinectRuntime = KinectSensor.KinectSensors[0]; kinectRuntime.SkeletonFrameReady += kinectRuntime_SkeletonFrameReady; kinectRuntime.DepthFrameReady += kinectRuntime_DepthFrameReady; kinectRuntime.DepthStream.Enable(); kinectRuntime.SkeletonStream.Enable(new TransformSmoothParameters() { Smoothing = 0.5f, Correction = 0.5f, Prediction = 0.5f, JitterRadius = 0.05f, MaxDeviationRadius = 0.04f }); // Depth Stream DepthImage.DataContext = depthStreamManager; // Events leftHandGestureRecognizer = new SwipeGestureDetector(); rightHandGestureRecognizer = new SwipeGestureDetector(); leftHandGestureRecognizer.OnGestureDetected += leftHandGestureRecognizer_OnGestureDetected; rightHandGestureRecognizer.OnGestureDetected += rightHandGestureRecognizer_OnGestureDetected; kinectRuntime.Start(); } catch { kinectRuntime = null; } }
private void CreateAndInitializeDefaultGestureRecognizers() { rightHandSwipeDetector = new SwipeGestureDetector(); rightHandSwipeDetector.OnGestureDetected += OnRightGestureDetected; leftHandSwipeDetector = new SwipeGestureDetector(); leftHandSwipeDetector.OnGestureDetected += OnLeftGestureDetected; File.Copy(@"..\..\SupportingFiles\default.csv", Environment.CurrentDirectory + @"\default.csv", true); ParseConfigs(Environment.CurrentDirectory + @"\default.csv"); voiceCommander = new VoiceCommander(keyWords); voiceCommander.OrderDetected += voiceCommander_OrderDetected; devicesComboBox.ItemsSource = midMan.GetTheListOfMidiDevices(); devicesComboBox.SelectedItem = midMan.CurrentOutputDeviceName(); System.IO.StreamReader fileToRead = new StreamReader(Environment.CurrentDirectory + @"\cache.txt"); lastConfigFilePath = fileToRead.ReadLine(); lastMIDIPath = fileToRead.ReadLine(); fileToRead.Close(); }
// Gestures private void InitializeGestures() { swipeGestureRecognizer = new SwipeGestureDetector(); swipeGestureRecognizer.OnGestureDetected += OnGestureDetected; }