Archivos para 5/11/11
[# KINECT] HowTo: Detect the change of State of the sensor Kinect
Publicado por elbruno en HowTo, Kinect, Tutorial, Visual Studio 2010 el 5 noviembre, 2011
Hi,
now that we already have the Beta 2 Kinect for Windows SDK in our hands, because we see as detected when you connect or disconnect a Kinect sensor to our computer.
Tutorial
1 Create an implementation of the WPF Application type
2 Add the following references
- Microsoft.research.Kinect
< % Program Files % > \Microsoft SDKs\Kinect\v1.0 Beta2\Assemblies\Microsoft.Research.Kinect.dll
3. Then we modify our MainWindow to initialize the capture of events in the Load of the Window.
1: <Window x:Class=”ElBruno.KinectStatus.MainWindow”
2: xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
3: xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
4: Title=”MainWindow” Height=”350″ Width=”525″ Loaded=”WindowLoaded”>
5: <Grid>
6:
7: </Grid>
8: </Window>
4 Implement the WindowLoad() event and in the same we subscribe to the change of State that fires when you connect one or more sensors Kinect.
1: using System.Windows;
2: using Microsoft.Research.Kinect.Nui;
3:
4: namespace ElBruno.KinectStatus
5: {
6: public partial class MainWindow : Window
7: {
8: public MainWindow()
9: {
10: InitializeComponent();
11: }
12:
13: private void WindowLoaded(object sender, RoutedEventArgs e)
14: {
15: Runtime.Kinects.StatusChanged += KinectsStatusChanged;
16: }
17:
18: private void KinectsStatusChanged(object sender, StatusChangedEventArgs e)
19: {
20: MessageBox.Show(e.Status.ToString());
21: }
22: }
23: }
5. At this point already, we can compile and run our application. After connecting and disconnecting the device several times we see something similar to the following
More easy impossible right? ![]()
keep playing…
Greetings @ Home
The Bruno
[#KINECT] HowTo: Detectar el cambio de estado del sensor Kinect
Publicado por elbruno en HowTo, Kinect, Tutorial, Visual Studio 11, Visual Studio 2010 el 5 noviembre, 2011
Buenas,
ahora que ya tenemos la Beta 2 de Kinect for Windows SDK en nuestras manos, pues veamos como detectar cuando se conecta o desconecta un sensor Kinect a nuestro ordenador.
Tutorial
1. Creamos una aplicación del tipo WPF Application
2. Agregamos las siguientes referencias
- Microsoft.Research.Kinect
<%Program Files%>\Microsoft SDKs\Kinect\v1.0 Beta2\Assemblies\Microsoft.Research.Kinect.dll
3. A continuación modificamos nuestro MainWindow para inicializar la captura de eventos en el Load de la Window.
1: <Window x:Class="ElBruno.KinectStatus.MainWindow"
2: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4: Title="MainWindow" Height="350" Width="525" Loaded="WindowLoaded">
5: <Grid>
6:
7: </Grid>
8: </Window>
4. Implementamos el evento WindowLoad() y en el mismo nos suscribimos al cambio de estado que se dispara cuando se conecta uno o más sensores Kinect.
1: using System.Windows;
2: using Microsoft.Research.Kinect.Nui;
3:
4: namespace ElBruno.KinectStatus
5: {
6: public partial class MainWindow : Window
7: {
8: public MainWindow()
9: {
10: InitializeComponent();
11: }
12:
13: private void WindowLoaded(object sender, RoutedEventArgs e)
14: {
15: Runtime.Kinects.StatusChanged += KinectsStatusChanged;
16: }
17:
18: private void KinectsStatusChanged(object sender, StatusChangedEventArgs e)
19: {
20: MessageBox.Show(e.Status.ToString());
21: }
22: }
23: }
5. En este punto ya podremos compilar y ejecutar nuestra aplicación. Después de conectar y desconectar varias veces el dispositivo podremos ver algo similar a lo siguiente
Más fácil imposible no ? ![]()
A seguir jugando …
Saludos @ Home
El Bruno





SocialVibe