示例#1
0
 void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     //INICIALIZA EL SENSOR
     sensork = KinectSensor.KinectSensors.FirstOrDefault();
     //VERIFICA SI ESTÁ CONECTADO A LA COMPUTADORA
     if (sensork == null)
     {
         MessageBox.Show("Se Necesita un sensor Kinect.");
         this.Close();
     }
     sensork.Start();
     //RESOLUCIÓN DE CÁMARA RGB 640x480 FPS=30
     sensork.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
     sensork.ColorFrameReady += new EventHandler<ColorImageFrameReadyEventArgs>(sensor_ColorFrameReady);
     //RESOLUCIÓN DE CÁMARA DE PROFUNDIDAD 320x240 FPS=30
     sensork.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);
     sensork.SkeletonStream.Enable();
     sensork.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(sensor_SkeletonFrameReady);
     //REINICIA LA ELEVACIÓN DEL SENSOR A 0  
     sensork.ElevationAngle = 0;
     //LLAMA A MÉTODO PARA FINALIZAR
     Application.Current.Exit += new ExitEventHandler(Current_Exit);
     //INICIA MOTOR DE RECONOCIMIENTO DE VOZ
     //InitializeSpeechRecognition();
 }
示例#2
0
        public void initialize( int elevationAngle = 0 )
        {
            try { kinectSensor = KinectSensor.KinectSensors[0]; }
            catch (Exception e)
            {
                Console.WriteLine("kinect not detected, continuing with kinect disabled {0}",e);
                return;
            }

            // limits elevation angle to keep the motors from trying too extreme an angle
            if (elevationAngle >= 26 )
            {
                elevationAngle = 26;
            }
            else if (elevationAngle <= -26)
            {
                elevationAngle = -26;
            }

            // Only initializes Skeletal Tracking
            kinectSensor.SkeletonStream.Enable();

            // set a call back function to process skeleton data
            kinectSensor.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinectSkeletonFrameReadyCallback);
            kinectSensor.Start();
            kinectSensor.ElevationAngle = elevationAngle;
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

            // Check to see if a Kinect is available
            if (KinectSensor.KinectSensors.Count == 0)
            {
                MessageBox.Show("No Kinects detected", "Camera Viewer");
                Application.Current.Shutdown();
            }

            // Get the first Kinect on the computer
            myKinect = KinectSensor.KinectSensors[0];
            DateTime date = DateTime.Now;
            sessiondate = date.ToLongDateString();
            // Start the Kinect running and select the depth camera
            try
            {
                myKinect.SkeletonStream.Enable();

                myKinect.Start();
            }
            catch
            {
                MessageBox.Show("Kinect initialise failed", "Camera Viewer");
                Application.Current.Shutdown();
            }

            // connect a handler to the event that fires when new frames are available

            myKinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(myKinect_SkeletonFrameReady);

        }
        public KinectGrabWheelController(WheelDelegate wheelDelegate, ScreenManager screenManager, KinectSensor kinect)
        {
            this.device = screenManager.GraphicsDevice;

            this.wheelDelegate = wheelDelegate;
            position = new Vector2();
            positionScreen = new Vector2();
            this.kinectSensor = kinect;

            //if (!kinect.IsRunning)
            //{
                var parameters = new TransformSmoothParameters
                {
                    Smoothing = 0.1f,
                    Correction = 0.0f,
                    Prediction = 0.0f,
                    JitterRadius = 1.0f,
                    MaxDeviationRadius = 0.5f
                };
                kinect.SkeletonStream.Enable(parameters);
                kinect.DepthStream.Enable();
                kinect.ColorStream.Enable();

                kinect.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(ks_AllFramesReady);

                interactionStream = new Microsoft.Kinect.Toolkit.Interaction.InteractionStream(kinect, new myIntClient());
                interactionStream.InteractionFrameReady += new EventHandler<InteractionFrameReadyEventArgs>(intStream_InteractionFrameReady);
                kinect.Start();
            //}
        }
示例#5
0
 private static void InitilizeKinect()
 {
     _sensor = KinectSensor.KinectSensors.SingleOrDefault();
     _sensor.SkeletonStream.Enable();
     _sensor.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(Sensor_SkeletonFrameReady);
     _sensor.Start();
 }
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            
            // this is just a test, so it only works with one Kinect, and quits if that is not available.
            _sensor = KinectSensor.KinectSensors.FirstOrDefault();
            if (_sensor == null)
            {
                MessageBox.Show("No Kinect Sensor detected!");
                Close();
                return;
            }
            
            //_sensor.SkeletonStream.EnableTrackingInNearRange = true;
            _sensor.SkeletonStream.Enable();

            _sensor.SkeletonFrameReady += NuiSkeletonFrameReady;

            _sensor.Start();
            IGestureDetector gestureDetector = new InteractiveGestureDetector(_sensor);
            ((InteractiveGestureDetector)gestureDetector).DumpReady += InteractionStreamOnInteractionFrameReady;
            IGestureDetector voiceDetector = new VoiceRecognition.KinectVoiceGestureDetector(_sensor);
            ICommandSender commandSender = new XbmcCommandSender();
            adapter = new GestureToCommandAdapter(@"GestureToCommand.XML", commandSender, gestureDetector, voiceDetector);
            adapter.ShowNotification = true;
            //Gestures
            gestureDetector.GestureDetected += gestureDetector_GestureDetected;
        }
示例#7
0
文件: Form1.cs 项目: motamed/Kinect
        private void btnStream_Click(object sender, EventArgs e)
        {
            if (btnStream.Text == "Stream")
            {

                if (KinectSensor.KinectSensors.Count > 0)
                {
                    sensor = KinectSensor.KinectSensors[0];
                    btnStream.Text = "Stop";
                    KinectSensor.KinectSensors.StatusChanged += KinectSensors_StatusChanged;
                    sensor.Start();
                    lblConID.Text = sensor.DeviceConnectionId;
                    sensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
                    sensor.ColorFrameReady += Sensor_ColorFrameReady;
                    sensor.ElevationAngle = 0;
                    sliderValue.Text = sliderAngle.Value.ToString();
                    sliderAngle.Value = 0;
                }

            }
            else
            {
                if (sensor != null && sensor.IsRunning)
                {
                    sensor.Stop();
                    btnStream.Text = "Stream";
                    pb.Image = null;

                }

            }
        }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     sensor = KinectSensor.KinectSensors[0];
     sensor.ColorStream.Enable();
     sensor.ColorFrameReady += VideoFrameReady;
     sensor.Start();
 }
 private void InicializarKinect()
 {
     Kinect = InicializadorKinect.InicializarPrimeiroSensor(0);
     Kinect.Start();
     Kinect.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
     Kinect.ColorFrameReady += Kinect_ColorFrameReady;
 }
示例#10
0
        public KinectControl(double layoutHeight, double layoutWidth)
        {
            _layoutHeight = layoutHeight;
            _layoutWidth = layoutWidth;

            _kinect = KinectSensor.KinectSensors.FirstOrDefault();
            _kinect.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;

            if (_kinect != null)
            {
                _kinect.Start();

                _kinect.ColorStream.Enable();
                _kinect.SkeletonStream.Enable(new TransformSmoothParameters
                {
                    Smoothing = 0.7f,
                    Correction = 0.1f,
                    Prediction = 0.1f,
                    JitterRadius = 0.05f,
                    MaxDeviationRadius = 0.05f
                });

                _activeRecognizer = CreateRecognizer();
                _kinect.SkeletonFrameReady += kinect_SkeletonFrameReady;
            }
        }
示例#11
0
        public void StartKinectST()
        {
            kinect = KinectSensor.KinectSensors.FirstOrDefault(s => s.Status == KinectStatus.Connected); // Get first Kinect Sensor
             // Get Ready for Skeleton Ready Events
            if (kinect != null)
            {
                kinect.SkeletonStream.Enable(); // Enable skeletal tracking

                skeletonData = new Skeleton[kinect.SkeletonStream.FrameSkeletonArrayLength]; // Allocate ST data

                //kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeletonFrameReady);
                kinect.SkeletonFrameReady += this.kinect_SkeletonFrameReady;

                Debug.WriteLine("skeleton enable");
            }
            try
            {
                kinect.Start();
            }
            catch (IOException)
            {
                kinect = null;
            }
            if (null == kinect)
            {
                Debug.WriteLine("Kinect failed to start...");
            }
            else
            {
                Debug.WriteLine("Kinect started...");

            }
        }
示例#12
0
		public void Start()
		{
			if(KinectSensor.KinectSensors.Count == 0)
			{
				Debug.WriteLine("No Kinects found.");
				Environment.Exit(-1);
			}

			_kinect = KinectSensor.KinectSensors[0];

			_kinect.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
			_kinect.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);
			_kinect.SkeletonStream.Enable();

			_kinect.Start();

			_colorListener = new ColorListener(_kinect, ColorPort, ImageFormat.Jpeg);
			_colorListener.Start();

			_depthListener = new DepthListener(_kinect, DepthPort);
			_depthListener.Start();

			_skeletonListener = new SkeletonListener(_kinect, SkeletonPort);
			_skeletonListener.Start();

			_audioListener = new AudioListener(_kinect, AudioPort);
			_audioListener.Start();

			IPAddress[] addresses = Dns.GetHostAddresses(Dns.GetHostName());
			string s = string.Empty;
			foreach(IPAddress address in addresses)
				s += Environment.NewLine + address;

			Debug.WriteLine("Waiting for client on..." + s);
		}
示例#13
0
        public KinectDance(double layoutHeight, double layoutWidth, List<TextBlock> menus, Style mouseOverStyle, Border menuBorder,TextBox debugBox = null)
        {
            _layoutHeight = layoutHeight;
            _layoutWidth = layoutWidth;
            _debugBox = debugBox;
            _menus = menus;
            _menuBorder = menuBorder;
            _mouseOverStyle = mouseOverStyle;

            _kinect = KinectSensor.KinectSensors.FirstOrDefault();

            if (_kinect == null) return;
            //_kinect.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
            _kinect.Start();

            _kinect.ColorStream.Enable();
            _kinect.SkeletonStream.Enable(new TransformSmoothParameters
                {
                    Smoothing = 0.7f,
                    Correction = 0.3f,
                    Prediction = 0.4f,
                    JitterRadius = 0.5f,
                    MaxDeviationRadius = 0.5f
                });

            _kinect.SkeletonFrameReady += kinect_SkeletonFrameReady;
        }
示例#14
0
        public Form1()
        {
            InitializeComponent();
            outputDevice.Open();
            try
            {
                if (KinectSensor.KinectSensors.Count == 0)
                {
                    throw new Exception("Kinectが接続されていません");
                }

                // Kinectインスタンスを取得する
                kinect = KinectSensor.KinectSensors[0];

                // すべてのフレーム更新通知をもらう
                kinect.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(kinect_AllFramesReady);

                // Color,Depth,Skeletonを有効にする
                kinect.SkeletonStream.Enable();

                // Kinectの動作を開始する
                kinect.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Close();
            }
        }
示例#15
0
        static void Main()
        {
            Init();

            try
            {
                logic = new Logic();
                sensor = KinectSensor.KinectSensors[0];

                sensor.Start();
                sensor.SkeletonStream.Enable();
                sensor.SkeletonStream.EnableTrackingInNearRange = true;

                timer = new Timer();
                timer.Interval = 500;
                timer.Elapsed += Timer_Elapsed;
                timer.Enabled = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.ReadLine();
        }
示例#16
0
        public void StartKinect()
        {
            // Checks to see how many Kinects are connected to the system. If None then exit.
            if (KinectSensor.KinectSensors.Count == 0)
            {
                Console.Out.WriteLine("There are no Kinects Connected");
                return;
            }

            // If there is a Kinect connected, get the Kinect
            ks = KinectSensor.KinectSensors[0];
            ks.Start();
            //Sets the initial elevation angle of the connect to 0 degrees
            ks.ElevationAngle = 0;

            // Set smoothing parameters for when Kinect is tracking a skeleton
            TransformSmoothParameters parameters = new TransformSmoothParameters()
            {
                Smoothing = 0.7f,
                Correction = 0.3f,
                Prediction = 0.4f,
                JitterRadius = 1.0f,
                MaxDeviationRadius = 0.5f,
            };

            ks.SkeletonStream.Enable(parameters);
            ks.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(ks_SkeletonFrameReady);
        }
示例#17
0
        /// <summary>
        /// Starts up Kinect
        /// </summary>
        void StartKinect()
        {
            try
            {
                kinect = KinectSensor.KinectSensors.FirstOrDefault();

                kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(runtime_SkeletonFrameReady);

                TransformSmoothParameters parameters = new TransformSmoothParameters()
                {
                    Smoothing = 0.75f,
                    Correction = 0.0f,
                    Prediction = 0.0f,
                    JitterRadius = 0.05f,
                    MaxDeviationRadius = 0.4f
                };

                kinect.SkeletonStream.Enable(parameters);
                
                this.skeletonData = new Skeleton[kinect.SkeletonStream.FrameSkeletonArrayLength];
                kinect.Start();
                Trace.WriteLine("Kinect initialized");
            }
            catch (Exception)
            {
                Trace.WriteLine("Error while initializing Kinect. Trying again in 5 seconds...");
                kinectRetryTimer.Start();
            }
        }
        public InputHandler(GraphicsDeviceManager graphicsManager)
        {
            graphics = graphicsManager;

            #if !XBOX360
            // Enable && initialize Kinect
            if (KinectSensor.KinectSensors.Count > 0)
            {
                sensor = KinectSensor.KinectSensors[0];
                if (sensor.Status == KinectStatus.Connected)
                {
                    TransformSmoothParameters parameters = new TransformSmoothParameters
                    {
                        Smoothing = 0.5f,
                        Correction = 0.5f,
                        Prediction = 0.4f,
                        JitterRadius = .2f,
                        MaxDeviationRadius = 0.1f
                    };
                    sensor.SkeletonStream.Enable(parameters);
                    //sensor.SkeletonStream.Enable();
                }
                sensor.Start();
            }
            #endif
        }
示例#19
0
        //Methode d'initialisation
        public void initializ()
        {
            //on associe a port , le port USB COM3
            port = new SerialPort ("COM3", 9600);
            //On ouvre le port pour l'envoie des données
            port.Open ();
            //On recupere la Kinect
            sensor = KinectSensor.KinectSensors[0];

               			// SmoothParamater pour reduire les interferances sur le SkeletonStream
            TransformSmoothParameters parameters = new TransformSmoothParameters{
                Smoothing = 0.3f,
                Correction = 0.0f,
                Prediction = 0.0f,
                JitterRadius = 1.0f,
                MaxDeviationRadius = 0.5f
            };
            //On demare la capture
            sensor.Start();
              			// Ouverture des flux
            sensor.ColorStream.Enable();
            sensor.DepthStream.Enable();
            sensor.SkeletonStream.Enable(parameters);
            //on ouvre une frame toute les 33 millisecondes
            //soit environ 30 images secondes.
            sensor.SkeletonStream.OpenNextFrame(33);
            //le Tracking du skelette est réalisé par défault:
                //20 joints , quelque soit la position de l'utilisateur.
            sensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Default;
            return;
        }
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public MainWindow()
        {
            try
            {
                InitializeComponent();

                // Kinectが接続されているかどうかを確認する
                if (KinectSensor.KinectSensors.Count == 0)
                {
                    throw new Exception("Kinectを接続してください");
                }

                // 現在認識されているKinectから一つを取り出す
                kinect = KinectSensor.KinectSensors[0];
                // RGBカメラを有効
                kinect.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
                // フレーム更新イベントを登録
                kinect.ColorFrameReady +=
                  new EventHandler<ColorImageFrameReadyEventArgs>(kinect_ColorFrameReady);

                // Kinectの動作を開始する
                kinect.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#21
0
        private void startKinect()
        {
            if (KinectSensor.KinectSensors.Count > 0)
            {
                // Choose the first Kinect device
                kinect = KinectSensor.KinectSensors[0];
                if (kinect == null)
                    return;

                kinect.ColorStream.Enable();

                var tsp = new TransformSmoothParameters
                {
                    Smoothing = 0.5f,
                    Correction = 0.5f,
                    Prediction = 0.5f,
                    JitterRadius = 0.05f,
                    MaxDeviationRadius = 0.04f
                };
                kinect.SkeletonStream.Enable(tsp);

                // Start skeleton tracking
                //kinect.ColorFrameReady += new EventHandler<ColorImageFrameReadyEventArgs>(kinect_ColorFrameReady);
                //kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeletonFrameReady);

                // Start Kinect device
                kinect.Start();
            }
            else
            {
                MessageBox.Show("No Kinect Device found.");
            }
        }
示例#22
0
        public void Initialize(GraphicsDeviceManager graphics)
        {
            try
            {
                kinect = KinectSensor.KinectSensors[0];
                //kinect.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
                //kinect.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);
                TransformSmoothParameters smoothingParam = new TransformSmoothParameters();
                smoothingParam.Smoothing = 0.5f;
                smoothingParam.Correction = 0.5f;
                smoothingParam.Prediction = 0.5f;
                smoothingParam.JitterRadius = 0.05f;
                smoothingParam.MaxDeviationRadius = 0.04f;
                kinect.SkeletonStream.Enable(smoothingParam);

                kinect.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(kinect_AllFramesReady);
                ready = true;
                kinect.Start();
                colorVideo = new Texture2D(graphics.GraphicsDevice, kinect.ColorStream.FrameWidth, kinect.ColorStream.FrameHeight);
                depthVideo = new Texture2D(graphics.GraphicsDevice, kinect.DepthStream.FrameWidth, kinect.DepthStream.FrameHeight);
                Debug.WriteLineIf(debugging, kinect.Status);
                status = "ok";
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                status = "error";
            }
        }
示例#23
0
        public override void Load()
        {
            try
            {
                IsEnabled = true;
                _kinect = KinectSensor.KinectSensors[0];

                var parameters = new TransformSmoothParameters
                {
                    Smoothing = 0.3f,
                    Correction = 0.0f,
                    Prediction = 0.0f,
                    JitterRadius = 1.0f,
                    MaxDeviationRadius = 0.5f
                };
                _kinect.SkeletonStream.Enable(parameters);

                _kinect.AllFramesReady += _kinect_AllFramesReady;
                _kinect.Start();

                RawRotation = Quaternion.Identity;
            }
            catch (Exception exc)
            {
                Logger.Instance.Error(exc.Message, exc);
                IsEnabled = false;
            }
        }
示例#24
0
        public MainWindow()
        {
            InitializeComponent();
            if (serverURL == "")
            {
                textBox1.Text = "URL不明!";
            }
            else
            {
                textBox1.Text = channel;
                websocket = new WebSocket(serverURL);
                websocket.Closed += new EventHandler(websocket_Closed);
                websocket.Error += new EventHandler<SuperSocket.ClientEngine.ErrorEventArgs>(websocket_Error);
                websocket.MessageReceived += new EventHandler<MessageReceivedEventArgs>(websocket_MessageReceived);
                websocket.Opened += new EventHandler(websocket_Opened);
                websocket.Open();

                InitializeComponent(); // aaa
                //Kinectの初期化
                kinect = KinectSensor.KinectSensors[0];
                //イベントハンドラの登録
                kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(handler_SkeletonFrameReady);
                //骨格トラッキングの有効化
                kinect.SkeletonStream.Enable();
                kinect.Start(); // aaa
            }
        }
示例#25
0
        public KinectControl(HoverButton kinectButton, double layoutHeight, double layoutWidth, List<Button> buttons, TextBox debugBox = null)
        {
            _kinectButton = kinectButton;
            _layoutHeight = layoutHeight;
            _layoutWidth = layoutWidth;
            _buttons = buttons;
            _debugBox = debugBox;

            _kinect = KinectSensor.KinectSensors.FirstOrDefault();

            if (_kinect != null)
            {
                _kinect.Start();

                _kinect.ColorStream.Enable();
                _kinect.SkeletonStream.Enable(new TransformSmoothParameters
                    {
                        Smoothing = 0.7f,
                        Correction = 0.1f,
                        Prediction = 0.1f,
                        JitterRadius = 0.05f,
                        MaxDeviationRadius = 0.05f
                    });

                _kinect.SkeletonFrameReady += kinect_SkeletonFrameReady;
            }

            _activeRecognizer = CreateRecognizer();
            _kinectButton.Click += KinectButton_Click;
        }
示例#26
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            sensor = KinectSensor.KinectSensors.FirstOrDefault();

            if (sensor == null)
            {
                MessageBox.Show("This application requires a Kinect sensor.");
                this.Close();
            }
            
            sensor.Start();

            sensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
            sensor.ColorFrameReady += new EventHandler<ColorImageFrameReadyEventArgs>(sensor_ColorFrameReady);

            sensor.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);
            sensor.SkeletonStream.Enable();
            sensor.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(sensor_SkeletonFrameReady);

            sensor.ElevationAngle = 0;

            Application.Current.Exit += new ExitEventHandler(Current_Exit);

            InitializeSpeechRecognition();
        }
示例#27
0
        private KinectHelper(TransformSmoothParameters tsp, bool near = false, 
                             ColorImageFormat colorFormat = ColorImageFormat.RgbResolution1280x960Fps12, 
                             DepthImageFormat depthFormat = DepthImageFormat.Resolution640x480Fps30)
        {
            _kinectSensor = KinectSensor.KinectSensors.FirstOrDefault(s => s.Status == KinectStatus.Connected);

            if (_kinectSensor == null)
            {
                throw new Exception("No Kinect-Sensor found.");
            }
            if (near)
            {
                _kinectSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
                _kinectSensor.DepthStream.Range = DepthRange.Near;
                _kinectSensor.SkeletonStream.EnableTrackingInNearRange = true;
            }

            DepthImageFormat = depthFormat;
            ColorImageFormat = colorFormat;

            _kinectSensor.SkeletonStream.Enable(tsp);
            _kinectSensor.ColorStream.Enable(colorFormat);
            _kinectSensor.DepthStream.Enable(depthFormat);
            _kinectSensor.AllFramesReady += AllFramesReady;

            _kinectSensor.Start();
            _faceTracker = new FaceTracker(_kinectSensor);
        }
示例#28
0
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            if (KinectSensor.KinectSensors.Count == 0)
            {
                MessageBox.Show("No se detecta ningun kinect");
                Application.Current.Shutdown();
            }

            miKinect = KinectSensor.KinectSensors.FirstOrDefault();

            try
            {
                miKinect.SkeletonStream.Enable();
                miKinect.ColorStream.Enable();
                miKinect.Start();
            }
            catch
            {
                MessageBox.Show("La inicializacion del Kinect fallo");
                Application.Current.Shutdown();
            }

            miKinect.SkeletonFrameReady += miKinect_SkeletonFrameReady;
            miKinect.ColorFrameReady += miKinect_ColorFrameReady;
        }
示例#29
0
 private void Window_Loaded_1(object sender, RoutedEventArgs e)
 {
     miKinect = KinectSensor.KinectSensors[0];
     miKinect.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
     miKinect.Start();
     miKinect.ColorFrameReady += miKinect_ColorFrameReady;
 }
示例#30
0
 private void Window_Loaded_1(object sender, RoutedEventArgs e)
 {
     miKinect = KinectSensor.KinectSensors.FirstOrDefault();
     miKinect.Start();
     miKinect.ColorStream.Enable();
     miKinect.ColorFrameReady += miKinect_ColorFrameReady;
 }
        public MainWindow()
        {
            InitializeComponent();

            this.Unloaded += delegate
            {
                _kinectSensor.ColorStream.Disable();
                _kinectSensor.DepthStream.Disable();
            };

            this.Loaded += delegate
            {
                _kinectSensor = KinectSensor.KinectSensors[0];
                _kinectSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
                _kinectSensor.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);
                _kinectSensor.ColorFrameReady += ColorFrameReady;
                _kinectSensor.DepthFrameReady += DepthFrameReady;

                _kinectSensor.Start();
            };
        }
示例#32
0
        private void StartKinect()
        {
            if (this.disposed)
            {
                throw new ObjectDisposedException(nameof(KinectSensor));
            }


            if (Microsoft.Kinect.KinectSensor.KinectSensors.Count > 0)
            {
                this.kinectSensor = Microsoft.Kinect.KinectSensor.KinectSensors[0];

                if (kinectSensor.Status == KinectStatus.Connected)
                {
                    //TODO use configurations to determine what to enable

                    kinectSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
                    kinectSensor.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);
                    kinectSensor.DepthStream.Range = DepthRange.Near;
                    kinectSensor.SkeletonStream.EnableTrackingInNearRange = true;
                    kinectSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
                    kinectSensor.SkeletonStream.Enable();

                    kinectSensor.AllFramesReady += Kinect_AllFramesReady;


                    kinectSensor.Start();


                    // Start streaming audio!
                    //this.audioStream = this.kinectSensor.AudioSource.Start();

                    // Use a separate thread for capturing audio because audio stream read operations
                    // will block, and we don't want to block main UI thread.
                    this.reading       = true;
                    this.readingThread = new Thread(AudioReadingThread);
                    //this.readingThread.Start();
                }
            }
        }
示例#33
0
        public MainWindow()
        {
            InitializeComponent();

            this.Unloaded += delegate {
                _kinectSensor.ColorStream.Disable();
                _kinectSensor.SkeletonStream.Disable();
            };

            this.Loaded += delegate
            {
                _kinectSensor = Microsoft.Kinect.KinectSensor.KinectSensors[0];
                _kinectSensor.ColorFrameReady += ColorFrameReady;
                _kinectSensor.ColorStream.Enable();


                _kinectSensor.SkeletonFrameReady += Pulse;
                _kinectSensor.SkeletonStream.Enable();
                _timer.Interval = new TimeSpan(0, 0, 1);
                _timer.Tick    += new EventHandler(_timer_Tick);

                _kinectSensor.Start();
            };
        }