예제 #1
0
        public MainWindow()
        {
            InitializeComponent();

            KinectRuntime = new Runtime();
            ColorStreamManager = new ColorStreamManager();
            InitializeKinect();

            Menus = new Dictionary<string, ListBox>();
            Breadcrumb = new Stack<ListBox>();
            InitializeMenu();
        }
예제 #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public MainWindowViewModel()
        {
            this.Preferences = new Preferences();
            this.Proxies = new Proxies(this.Preferences);

            this.LoadData();

            // Create Nao teacher.
            this.NaoTeacher = new NaoTeacher(this.Preferences, this.Proxies, this.Scenario);

            // Color stream.
            this.ColorStreamManager = new ColorStreamManager();
            this.ColorStreamManager.PropertyChanged += this.ColorStreamManagerPropertyChanged;

            this.Proxies.KinectSensor.ColorFrameReady += this.KinectSensorColorFrameReady;

            // Skeleton stream.
            this.Proxies.KinectSensor.SkeletonFrameReady += this.KinectSensorSkeletonFrameReady;
            this.Proxies.KinectSensor.SkeletonFrameReady += this.NaoTeacher.KinectSensorSkeletonFrameReady;

            //this.Scenario.Add(new LeftHandPunchScene("C:\\Users\\bootsman\\Desktop\\data.v1.kinect", new Score(20, 5)));
            //this.Scenario.Add(new GedanBaraiScene("C:\\Users\\bootsman\\Desktop\\data.v2.kinect", new Score(30, 10)));
            //this.Scenario.Add(new RightHandPunchScene("C:\\Users\\bootsman\\Desktop\\data.v3.kinect", new Score(20, 5)));
        }
예제 #3
0
 public void LoadColorManager(Image colorDisplay)
 {
     colorManager = new ColorStreamManager();
     colorDisplay.DataContext = colorManager;
 }
예제 #4
0
        public void Dispose()
        {
            if (skeletonDisplayManager != null)
            {
                skeletonDisplayManager = null;
            }
            if (colorManager != null)
            {
                colorManager = null;
            }
            if (depthManager != null)
            {
                depthManager = null;
            }

            if (speechRecognizer != null)
            {
                speechRecognizer.SpeechRecognized -= Speech_Recognized;
                speechRecognizer.Dispose();
                speechRecognizer = null;
            }
            
            if (gestureRecognizer != null)
            {
                gestureRecognizer.GestureRecognzied -= Gesture_Recognzied;
                gestureRecognizer.Dispose();
                gestureRecognizer = null;
            }

            if (kinectSensor != null)
            {
                kinectSensor.ColorFrameReady -= kinectRuntime_ColorFrameReady;
                kinectSensor.SkeletonFrameReady -= kinectRuntime_SkeletonFrameReady;
                kinectSensor.ColorFrameReady -= kinectRuntime_ColorFrameReady;
                kinectSensor.Stop();
                kinectSensor = null;
            }
        }
        /// <summary>
        /// Initialize the manager for use.
        /// </summary>
        public void Initialize()
        {
            if (kinect != null)
                return;

            kinect = Runtime.Kinects.Where(k => k.Status == KinectStatus.Connected).FirstOrDefault();

            if (kinect == null)
                return;

            this.kinect.Initialize(RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor);
            this.kinect.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);

            this.skeletonDisplayManager = new SkeletonDisplayManager(kinect.SkeletonEngine, skeletonCanvas);
            this.IsSkeletonVisible = true;

            this.displayStreamManager = new ColorStreamManager();

            kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeletonFrameReady);
            kinect.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(kinect_VideoFrameReady);

            var handler = KinectConnected;
            if (handler != null)
                handler(kinect);
        }