private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            uiData = new UIDataModel();
            //this.gridRoot.DataContext = uiData;
            sv = new Supervisor(uiData);
            sv.AlarmOccurEvent += new Supervisor.AlarmOccurHandler(sv_AlarmOccurEvent);
            kinectManager       = new KinectManager();

            wavPlayer = new WavePlayer();

            if (kinectManager.InitializeSensor())
            {
                // This is the bitmap we'll display on-screen
                this.colorBitmap = new WriteableBitmap(kinectManager.sensor.ColorStream.FrameWidth, kinectManager.sensor.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.imgDisplayer.Source = this.colorBitmap;

                // sensor started
                kinectManager.DataReadyEvent += new KinectManager.DataReadyHandler(kinectManager_DataReadyEvent);

                Thread bgWorker = new Thread(this.sv.DataHandleThreadMethod);
                bgWorker.Name         = "Background Image Worker";
                bgWorker.IsBackground = true;
                bgWorker.Start();

                uiData.Status = "Kinect Connected";
            }
            else
            {
                uiData.Status = "Kinect Not Connected";
                MessageBox.Show("Please connect Kinect first and restart this application.");
                //this.Close();
            }
        }
Пример #2
0
        public Supervisor(UIDataModel dm)
        {
            dataBuffer = new ConcurrentQueue <RawImageSource>();
            detector   = new SmockDetector();
            dataModel  = dm;

            faceRec = new FaceRecognition();
        }