Ejemplo n.º 1
0
        private void Initialize()
        {
            if (kinectRuntime == null)
                return;

            kinectRuntime.Initialize(RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor);
            kinectRuntime.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);
            kinectRuntime.SkeletonFrameReady += kinectRuntime_SkeletonFrameReady;
            kinectRuntime.VideoFrameReady += kinectRuntime_VideoFrameReady;

            swipeGestureRecognizer.OnGestureDetected += OnGestureDetected;

            //skeletonDisplayManager = new SkeletonDisplayManager(kinectRuntime.SkeletonEngine, kinectCanvas);

            kinectRuntime.SkeletonEngine.TransformSmooth = true;
            var parameters = new TransformSmoothParameters
            {
                Smoothing = 1.0f,
                Correction = 0.1f,
                Prediction = 0.1f,
                JitterRadius = 0.05f,
                MaxDeviationRadius = 0.05f
            };
            kinectRuntime.SkeletonEngine.SmoothParameters = parameters;

            LoadCircleGestureDetector();
            LoadLetterTPostureDetector();

            nuiCamera = new BindableNUICamera(kinectRuntime.NuiCamera);

            //elevationSlider.DataContext = nuiCamera;

            //voiceCommander = new VoiceCommander("record", "stop");
            //voiceCommander.OrderDetected += voiceCommander_OrderDetected;

            //StartVoiceCommander();
        }
        //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
        }
Ejemplo n.º 3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            circleKBPath = Path.Combine(Environment.CurrentDirectory, @"data\circleKB.save");
            letterT_KBPath = Path.Combine(Environment.CurrentDirectory, @"data\t_KB.save");
            try
            {
                kinectRuntime = new Runtime();
                kinectRuntime.Initialize(RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor);
                kinectRuntime.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);
                kinectRuntime.SkeletonFrameReady += kinectRuntime_SkeletonFrameReady;
                kinectRuntime.VideoFrameReady += kinectRuntime_VideoFrameReady;

                swipeGestureRecognizer.OnGestureDetected += OnGestureDetected;

                skeletonDisplayManager = new SkeletonDisplayManager(kinectRuntime.SkeletonEngine, kinectCanvas);

                kinectRuntime.SkeletonEngine.TransformSmooth = true;
                var parameters = new TransformSmoothParameters
                {
                    Smoothing = 1.0f,
                    Correction = 0.1f,
                    Prediction = 0.1f,
                    JitterRadius = 0.05f,
                    MaxDeviationRadius = 0.05f
                };
                kinectRuntime.SkeletonEngine.SmoothParameters = parameters;

                LoadCircleGestureDetector();
                LoadLetterTPostureDetector();

                nuiCamera = new BindableNUICamera(kinectRuntime.NuiCamera);

                elevationSlider.DataContext = nuiCamera;

                voiceCommander = new VoiceCommander("record", "stop");
                voiceCommander.OrderDetected += voiceCommander_OrderDetected;

                StartVoiceCommander();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        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;
        }
Ejemplo n.º 5
0
        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.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;
            _gestureSuite = new GestureSuite();
            _gestureSuite.OnGestureDetected += OnGestureDetected;
            _gestureSuite.OnGestureDetected += UpdateGestureList;
            skeletonDisplayManager = new SkeletonDisplayManager(_kinectSensor, kinectCanvas);

            _kinectSensor.Start();

            LoadLetterTPostureDetector();

            nuiCamera = new BindableNUICamera(_kinectSensor);

            elevationSlider.DataContext = nuiCamera;

            voiceCommander = new VoiceCommander("record", "stop");
            voiceCommander.OrderDetected += voiceCommander_OrderDetected;

            StartVoiceCommander();

            kinectDisplay.DataContext = colorManager;
        }
Ejemplo n.º 6
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            circleKBPath = Path.Combine(Environment.CurrentDirectory, @"data\circleKB.save");
            //rectangle
            rectangleKBPath = Path.Combine(Environment.CurrentDirectory, @"data\rectangleKB.save");

            //new gesture Step3: add new path
            pigtailKBPath = Path.Combine(Environment.CurrentDirectory, @"data\pigtailKB.save");
            checkKBPath = Path.Combine(Environment.CurrentDirectory, @"data\checkKB.save");
            starKBPath = Path.Combine(Environment.CurrentDirectory, @"data\starKB.save");

            letterT_KBPath = Path.Combine(Environment.CurrentDirectory, @"data\t_KB.save");

            //presentation: add presentation images to image array
            presentationImages[0] = presentationImage0;
            presentationImages[1] = presentationImage1;
            presentationImages[2] = presentationImage3;
            presentationImages[3] = presentationImage4;
            presentationImages[4] = presentationImage5;
            //presentationImages[5] = presentationImage5;

            try
            {
                kinectRuntime = new Runtime();
                kinectRuntime.Initialize(RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor);
                kinectRuntime.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);
                kinectRuntime.SkeletonFrameReady += kinectRuntime_SkeletonFrameReady;
                kinectRuntime.VideoFrameReady += kinectRuntime_VideoFrameReady;

                swipeGestureRecognizer.OnGestureDetected += OnGestureDetected;

                skeletonDisplayManager = new SkeletonDisplayManager(kinectRuntime.SkeletonEngine, kinectCanvas);

                kinectRuntime.SkeletonEngine.TransformSmooth = true;
                var parameters = new TransformSmoothParameters
                {
                    Smoothing = 1.0f,
                    Correction = 0.1f,
                    Prediction = 0.1f,
                    JitterRadius = 0.05f,
                    MaxDeviationRadius = 0.05f
                };
                kinectRuntime.SkeletonEngine.SmoothParameters = parameters;

                LoadCircleGestureDetector();
                LoadLetterTPostureDetector();
                //rectangle
                LoadRectangleGestureDetector();

                //new gesture Step4: load new detector();
                LoadPigtailGestureDetector();
                LoadCheckGestureDetector();
                LoadStarGestureDetector();

                nuiCamera = new BindableNUICamera(kinectRuntime.NuiCamera);

                elevationSlider.DataContext = nuiCamera;

                //voiceCommander = new VoiceCommander("record", "stop");

                //new gesture Step5: add new voice commander
                voiceCommander = new VoiceCommander("record", "stop", "circle", "rectangle", "flashstar",
                    "pigtail", "check", "end", "delete circle", "delete rectangle", "delete pigtail", "delete check", "delete flashstar");
                voiceCommander.OrderDetected += voiceCommander_OrderDetected;

                StartVoiceCommander();

                //presentationVideo.Stop();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void Initialize()
        {
            InitialisationVille();
            if(kinectSensor == null)
                return;

            //kinectSensor.ColorStream.Enable(ColorImageFormat.RgbResolution1280x960Fps12);
            kinectSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);

            kinectSensor.ColorFrameReady += kinectRuntime_ColorFrameReady;

            kinectSensor.DepthStream.Enable(DepthImageFormat.Resolution80x60Fps30);
            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;

            swipeGestureReconnaissance = new NotreGestureDetecteur();
            swipeGestureReconnaissance.OnGestureDetected += OnGestureDetected;

            skeletonDisplayManager = new SkeletonDisplayManager(kinectSensor, kinectCanvas);
            kinectSensor.Start();

            nuiCamera = new BindableNUICamera(kinectSensor);
            zoneDeposable.Add(zoneLille);
            zoneDeposable.Add(zoneAix);
            zoneDeposable.Add(zoneBordeaux);
            zoneDeposable.Add(zoneLyon);
            zoneDeposable.Add(zoneNancy);
            zoneDeposable.Add(zoneNantes);
            zoneDeposable.Add(zoneOrléans);
            zoneDeposable.Add(zoneRennes);
            zoneDeposable.Add(zoneToulouse);
            zoneDeposable.Add(zoneParis);
            lesZonesDepots = new ZoneDeDepot(zoneDeposable);

            RecognizerInfo ri = GetKinectRecognizer();
            if (null != ri)
            {

               this.speechEngine = new SpeechRecognitionEngine(ri.Id);

               try
               {
                   // Create a grammar from grammar definition XML file.
                   using (var memoryStream = new MemoryStream(Encoding.ASCII.GetBytes(Properties.Resources.SpeechGrammar)))
                   {
                       Grammar g = new Grammar(memoryStream);
                       speechEngine.LoadGrammar(g);
                       Console.WriteLine("Reconnaissance vocale");
                   }
               }
               catch (ArgumentNullException a)
               {
                   Console.WriteLine("ERRREUR RECONNAISSANCE "+a);
               }
               catch (InvalidOperationException e)
               {
                    Console.WriteLine("ERRREUR RECONNAISSANCE "+e);
               }
               speechEngine.SpeechRecognized += SpeechRecognized;

                speechEngine.SetInputToAudioStream(
                    kinectSensor.AudioSource.Start(), new SpeechAudioFormatInfo(EncodingFormat.Pcm, 16000, 16, 1, 32000, 2, null));
                speechEngine.RecognizeAsync(RecognizeMode.Multiple);
            }
               //Initialisation des boutons des villes
            String villeprincipale = villes.getNomVilleInitiale();
            btn1.Text = villeprincipale;
            textBoxInfoVille.FontSize = 18;
            LogTextBox.FontSize = 18;
            suivant.Text = villes.recupererNomVille(villeprincipale, "previous");
            precedent.Text = villes.recupererNomVille(villeprincipale, "next");
            textBoxInfoVille.Text = InformationVille.informationLille(); //lille debut
            Lille1Logo.Opacity = 1;//lille debut
            Lille1Logo.LoadedBehavior = MediaState.Play; //lilleDebut
            //a voir
            this.Cursor = Cursors.None;
        }