示例#1
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);
            }
        }
示例#2
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);
            }
        }