Archive for category Tutorial
[#KINECT] HowTo: Change the camera angle
Publicado por elbruno en Code Sample, HowTo, Kinect, Tutorial, Visual Studio 2010 el 14 noviembre, 2011
Hi,
in today’s post we will move the angle of the sensor up or down using the SDK APIs.
It is initially possible to move the camera up or down a twenty-seventh, and to try them we will from the example of yesterday.
1 We modify our application to allow us to define the angle of inclination of the Kinect using a text box and a button.
2. The Xaml is as the following example
1: <Window x:Class="ElBruno.KinectViewer.MainWindow"
2: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4: Title="El Bruno - Kinect Viewer" Height="480" Width="740">
5: <Grid>
6: <Grid.RowDefinitions>
7: <RowDefinition Height="40"></RowDefinition>
8: <RowDefinition Height="*"></RowDefinition>
9: <RowDefinition Height="40"></RowDefinition>
10: </Grid.RowDefinitions>
11: <TextBlock Text="Camera Viewer" FontSize="20" HorizontalAlignment="Center"
12: Foreground="Black" Grid.Row="0" />
13: <Image x:Name="CameraViewer" Margin="10,10,10,10"
14: Stretch="Fill" Grid.Row="1" />
15: <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="2" >
16: <TextBox x:Name="txtAngle" Text="0" FontSize="20" HorizontalAlignment="Center" Foreground="Black" />
17: <Button x:Name="SetCameraAngle" Click="SetCameraAngle_Click" Content="Set Camera Angle" />
18: </StackPanel>
19: </Grid>
20: </Window>
3. Then the implementation of the event click of the button is rather simple
1: private void SetCameraAngleClick(object sender, RoutedEventArgs e)
2: {
3: _kinect.NuiCamera.ElevationAngle = Convert.ToInt32(txtAngle.Text);
4: }
Today I will not put the example to download because it is quite simple to modify. And tomorrow some Audio and Speech if the bird allow me.
Greetings @ Here
The Bruno
[#KINECT] HowTo: Cambiar el ángulo de la cámara
Publicado por elbruno en Code Sample, HowTo, Kinect, Tutorial, Visual Studio 2010 el 14 noviembre, 2011
Buenas,
en el post de hoy vamos a mover el ángulo del sensor hacia arriba o hacia abajo utilizando las APIs del SDK.
Inicialmente es posible mover la cámara hacia arriba o hacia abajo unos 27º, y para probarlos vamos a partir del ejemplo del día de ayer.
1. Modificamos nuestra aplicación para que nos permita definir el ángulo de inclinación del Kinect utilizando una caja de texto y un botón.
2. El Xaml queda como el siguiente ejemplo
1: <Window x:Class="ElBruno.KinectViewer.MainWindow"
2: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4: Title="El Bruno - Kinect Viewer" Height="480" Width="740">
5: <Grid>
6: <Grid.RowDefinitions>
7: <RowDefinition Height="40"></RowDefinition>
8: <RowDefinition Height="*"></RowDefinition>
9: <RowDefinition Height="40"></RowDefinition>
10: </Grid.RowDefinitions>
11: <TextBlock Text="Camera Viewer" FontSize="20" HorizontalAlignment="Center"
12: Foreground="Black" Grid.Row="0" />
13: <Image x:Name="CameraViewer" Margin="10,10,10,10"
14: Stretch="Fill" Grid.Row="1" />
15: <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="2" >
16: <TextBox x:Name="txtAngle" Text="0" FontSize="20" HorizontalAlignment="Center" Foreground="Black" />
17: <Button x:Name="SetCameraAngle" Click="SetCameraAngle_Click" Content="Set Camera Angle" />
18: </StackPanel>
19: </Grid>
20: </Window>
3. Luego la implementación del evento click del botón es más bien simple
1: private void SetCameraAngleClick(object sender, RoutedEventArgs e)
2: {
3: _kinect.NuiCamera.ElevationAngle = Convert.ToInt32(txtAngle.Text);
4: }
Hoy no pondré el ejemplo para descargar ya que es bastante simple de modificar. Y para mañana algo de Audio y Speech si el AVE me lo permite.
Saludos @ Here
El Bruno
[# KINECT] HowTo: Display the contents of the camera in WPF
Publicado por elbruno en Code Sample, HowTo, Kinect, Tutorial, Visual Studio 2010 el 13 noviembre, 2011
Hi,
After displaying as it paints the Skeleton in Kinect here and here, today we are going to a more simple example (in what should be) where we will show the contents of the Chamber about Kinect in a WPF IMAGE.
Tutorial
1. Create a new type WPF Application project in Visual Studio 2010.
2 Add the following references
- Microsoft.research.Kinect
< % Program Files % > \Microsoft SDKs\Kinect\v1.0 Beta2\Assemblies\Microsoft.Research.Kinect.dll
3 We modify the MainWindow to display a title and an Image where we’ll show you the contents of the Chamber
1: <Window x:Class="ElBruno.KinectViewer.MainWindow"
2: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4: Title="El Bruno - Kinect Viewer" Height="480" Width="740">
5: <Grid>
6: <TextBlock Text="Camera Viewer" FontSize="20"
7: HorizontalAlignment="Center" Foreground="Black" />
8: <Image x:Name="CameraViewer" Margin="10,40,10,10" Stretch="Fill" />
9: </Grid>
10: </Window>
4. Then we initialized the runtime about Kinect (lines 17 to 26), taking into account that we will only use the feed from the camera (line 22). We we also subscribe to the VideoFrameReady() event, which is that will deliver us the information to process and display it in our Image (line 36).
1: public partial class MainWindow
2: {
3: private Runtime _kinect;
4: private InteropBitmapHelper _imageHelper;
5:
6: public MainWindow()
7: {
8: InitializeComponent();
9: Loaded += MainWindowLoaded;
10: }
11:
12: void MainWindowLoaded(object sender, RoutedEventArgs e)
13: {
14: InitKinect();
15: }
16:
17: void InitKinect()
18: {
19: if (Runtime.Kinects.Count == 0)
20: return;
21: _kinect = Runtime.Kinects[0];
22: _kinect.Initialize(RuntimeOptions.UseColor);
23: _kinect.VideoStream.Open(ImageStreamType.Video, 2,
24: ImageResolution.Resolution640x480, ImageType.Color);
25: _kinect.VideoFrameReady += KinectVideoFrameReady;
26: }
27:
28: void KinectVideoFrameReady(object sender, ImageFrameReadyEventArgs e)
29: {
30: var planarImage = e.ImageFrame.Image;
31: if (_imageHelper == null)
32: {
33: _imageHelper = new InteropBitmapHelper(planarImage.Width,
34: planarImage.Height,
35: planarImage.Bits);
36: CameraViewer.Source = _imageHelper.InteropBitmap;
37: }
38: else
39: {
40: _imageHelper.UpdateBits(planarImage.Bits);
41: }
42: }
43: }
5. In this example I’m using a class distributed with the SDK Kinect, InteropBitmapHelper that helps us work more effectively with the pictures.
6. Once completed the project, you can now run the same and we can see the feed from the camera’s sensor Kinect
Note: I know, Tablet, HP TouchSmart, 2 laptops, etc. too for a Sunday… ![]()
You can download the example since
Greetings @ Home
The Bruno
[#KINECT] HowTo: Mostrar el contenido de la cámara en WPF
Publicado por elbruno en HowTo, Kinect, Tutorial, Visual Studio 2010 el 13 noviembre, 2011
Buenas,
después de mostrar como se pinta el Skeleton en Kinect aquí y aquí, hoy vamos a un ejemplo más simple (en lo que cabe) donde mostraremos el contenido de la cámara de Kinect en un IMAGE de WPF.
Tutorial
1. Crear un nuevo proyecto de tipo WPF Application en Visual Studio 2010.
2. Agregamos las siguientes referencias
- Microsoft.Research.Kinect
<%Program Files%>\Microsoft SDKs\Kinect\v1.0 Beta2\Assemblies\Microsoft.Research.Kinect.dll
3. Modificamos la MainWindow para mostrar un título y un Image donde mostraremos el contenido de la cámara
1: <Window x:Class="ElBruno.KinectViewer.MainWindow"
2: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4: Title="El Bruno - Kinect Viewer" Height="480" Width="740">
5: <Grid>
6: <TextBlock Text="Camera Viewer" FontSize="20"
7: HorizontalAlignment="Center" Foreground="Black" />
8: <Image x:Name="CameraViewer" Margin="10,40,10,10" Stretch="Fill" />
9: </Grid>
10: </Window>
4. A continuación inicializamos el runtime de Kinect (líneas 17 a 26), teniendo en cuenta que solo utilizaremos el feed de la cámara (línea 22). Además nos suscribimos al evento VideoFrameReady() que es el que nos entregará la información para procesarla y mostrarla en nuestro Image (línea 36).
1: public partial class MainWindow
2: {
3: private Runtime _kinect;
4: private InteropBitmapHelper _imageHelper;
5:
6: public MainWindow()
7: {
8: InitializeComponent();
9: Loaded += MainWindowLoaded;
10: }
11:
12: void MainWindowLoaded(object sender, RoutedEventArgs e)
13: {
14: InitKinect();
15: }
16:
17: void InitKinect()
18: {
19: if (Runtime.Kinects.Count == 0)
20: return;
21: _kinect = Runtime.Kinects[0];
22: _kinect.Initialize(RuntimeOptions.UseColor);
23: _kinect.VideoStream.Open(ImageStreamType.Video, 2,
24: ImageResolution.Resolution640x480, ImageType.Color);
25: _kinect.VideoFrameReady += KinectVideoFrameReady;
26: }
27:
28: void KinectVideoFrameReady(object sender, ImageFrameReadyEventArgs e)
29: {
30: var planarImage = e.ImageFrame.Image;
31: if (_imageHelper == null)
32: {
33: _imageHelper = new InteropBitmapHelper(planarImage.Width,
34: planarImage.Height,
35: planarImage.Bits);
36: CameraViewer.Source = _imageHelper.InteropBitmap;
37: }
38: else
39: {
40: _imageHelper.UpdateBits(planarImage.Bits);
41: }
42: }
43: }
5. En este ejemplo estoy utilizando una clase distribuida con el SDK de Kinect, InteropBitmapHelper que nos ayuda a trabajar de una forma más efectiva con las imágenes.
6. Una vez terminado el proyecto, ya podemos ejecutar el mismo y podremos ver el feed de la cámara del sensor Kinect
Nota: ya lo sé, la tableta, un HP TouchSmart, 2 portátiles, etc. demasiado para un domingo … ![]()
Puedes descargar el ejemplo desde
Saludos @ Home
El Bruno
[#KINECT] HowTo: Draw the Kinect skeleton in WPF
Publicado por elbruno en HowTo, Kinect, Tutorial, Visual Studio 2010 el 11 noviembre, 2011
Hi,
Today plays close on Friday with a tutorial on the interesting > how to paint a skeleton in WPF using the 2 Kinect Beta for Windows SDK. The basis of a skeleton in Kinect is a collection of Joints that then we can "assemble the skeleton". It is also possible to assemble and paint more than one skeleton, for this example, because we only paint skeleton [0] in yellow.
Tutorial
1. Create a new type WPF Application project in Visual Studio 2010.
2 Add the following references
- Microsoft.research.Kinect
< % Program Files % > \Microsoft SDKs\Kinect\v1.0 Beta2\Assemblies\Microsoft.Research.Kinect.dll
3 We modify the MainWindow to display a title and a Canvas where we’ll show you the skeleton
1: <Window x:Class="ElBruno.KinectSkeleton01.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="480" Width="360">
5: <Grid>
6: <TextBlock Text="El Bruno - Skeleton Viewer"
7: FontSize="20" HorizontalAlignment="Center" />
8: <Canvas x:Name="Skeleton" Margin="10,40,10,10"
9: Background="Black" />
10: </Grid>
11: </Window>
The window is similar to the following
4 Add a handler for the event Load() for the Window. We also added a runtime to work against the Kinect and initialize it with the basic options of work.
1: private Runtime _kinect;
2:
3: public MainWindow()
4: {
5: InitializeComponent();
6: Loaded += MainWindowLoaded;
7: }
8:
9: void MainWindowLoaded(object sender, RoutedEventArgs e)
10: {
11: InitKinect();
12: }
13:
14: void InitKinect()
15: {
16: if (Runtime.Kinects.Count == 0)
17: return;
18:
19: _kinect = Runtime.Kinects[0];
20: _kinect.Initialize(RuntimeOptions.UseDepthAndPlayerIndex |
21: RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor);
22:
23: _kinect.VideoStream.Open(ImageStreamType.Video, 2,
24: ImageResolution.Resolution640x480, ImageType.Color);
25: _kinect.DepthStream.Open(ImageStreamType.Depth, 2,
26: ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex);
27: _kinect.SkeletonFrameReady += KinectSkeletonFrameReady;
28: }
In this example I have not put any kind of exception handling, working with a Beta we should add something later.
5. Below we can only paint our skeleton in Kinect. For this we will use the collection of Joints that returns us the Runtime and in the event KinectSkeletonFrameReady brush the Joints and Bones that unite them.
1: void KinectSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
2: {
3: foreach (var skeleton in
4: e.SkeletonFrame.Skeletons.Where
5: (skeleton =>
6: SkeletonTrackingState.Tracked == skeleton.TrackingState))
7: {
8: Skeleton.Children.Clear();
9: PaintBones(skeleton);
10: PaintJoints(skeleton);
11: }
12: }
6. Course for this to work the previous routine requires implementation of PaintJoins and PaintBones. As you can see in the following code fragment, it is quite simple because only run through the collections and paints from them.
1: private void PaintJoints(SkeletonData skeleton)
2: {
3: foreach (Joint joint in skeleton.Joints)
4: {
5: var jointPos = _kinectCanvas.GetDisplayPosition(joint);
6: var jointLine = new Line
7: {
8: X1 = jointPos.X - 3
9: };
10: jointLine.X2 = jointLine.X1 + 6;
11: jointLine.Y1 = jointLine.Y2 = jointPos.Y;
12: jointLine.Stroke = KinectCanvas.JointColors[joint.ID];
13: jointLine.StrokeThickness = 6;
14: Skeleton.Children.Add(jointLine);
15: }
16: }
17:
18: private void PaintBones(SkeletonData skeleton)
19: {
20: var brush = new SolidColorBrush(Colors.Yellow);
21: Skeleton.Children.Add(_kinectCanvas.GetBodySegment
22: (skeleton.Joints, brush, JointID.HipCenter,
23: JointID.Spine, JointID.ShoulderCenter, JointID.Head));
24: Skeleton.Children.Add(_kinectCanvas.GetBodySegment
25: (skeleton.Joints, brush, JointID.ShoulderCenter,
26: JointID.ShoulderLeft, JointID.ElbowLeft, JointID.WristLeft, JointID.HandLeft));
27: Skeleton.Children.Add(_kinectCanvas.GetBodySegment
28: (skeleton.Joints, brush, JointID.ShoulderCenter,
29: JointID.ShoulderRight, JointID.ElbowRight, JointID.WristRight, JointID.HandRight));
30: Skeleton.Children.Add(_kinectCanvas.GetBodySegment
31: (skeleton.Joints, brush, JointID.HipCenter, JointID.HipLeft,
32: JointID.KneeLeft, JointID.AnkleLeft, JointID.FootLeft));
33: Skeleton.Children.Add(_kinectCanvas.GetBodySegment
34: (skeleton.Joints, brush, JointID.HipCenter, JointID.HipRight,
35: JointID.KneeRight, JointID.AnkleRight, JointID.FootRight));
36: }
In the full example you can see the KinectCanvas() class which is you own definitions to convert points joints and bones in lines.
7. If we run the application and are quick to take a screenshot can something similar to
The complete example can be downloaded from
Greetings @ Here
The Bruno
[#KINECT] HowTo: Pintar un skeleton en WPF
Publicado por elbruno en HowTo, Kinect, Tutorial, Visual Studio 2010 el 11 noviembre, 2011
Buenas,
Hoy toca cerrar el viernes con un tutorial de los interesantes > como pintar un skeleton en WPF utilizando la Beta 2 del Kinect for Windows SDK. La base de un skeleton en Kinect es una colección de Joints con los que luego podemos “armar el skeleton”. Además es posible armar y pintar más de un skeleton, para este ejemplo, pues solo pintamos el skeleton[0] en amarillo.
Tutorial
1. Crear un nuevo proyecto de tipo WPF Application en Visual Studio 2010.
2. Agregamos las siguientes referencias
- Microsoft.Research.Kinect
<%Program Files%>\Microsoft SDKs\Kinect\v1.0 Beta2\Assemblies\Microsoft.Research.Kinect.dll
3. Modificamos la MainWindow para mostrar un título y un Canvas donde mostraremos el skeleton
1: <Window x:Class="ElBruno.KinectSkeleton01.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="480" Width="360">
5: <Grid>
6: <TextBlock Text="El Bruno - Skeleton Viewer"
7: FontSize="20" HorizontalAlignment="Center" />
8: <Canvas x:Name="Skeleton" Margin="10,40,10,10"
9: Background="Black" />
10: </Grid>
11: </Window>
La ventana queda similar a la siguiente
4. Agregamos un manejador para el evento Load() de la Window. Además agregamos un runtime para trabajar contra el Kinect e inicializamos el mismo con las opciones básicas de trabajo.
1: private Runtime _kinect;
2:
3: public MainWindow()
4: {
5: InitializeComponent();
6: Loaded += MainWindowLoaded;
7: }
8:
9: void MainWindowLoaded(object sender, RoutedEventArgs e)
10: {
11: InitKinect();
12: }
13:
14: void InitKinect()
15: {
16: if (Runtime.Kinects.Count == 0)
17: return;
18:
19: _kinect = Runtime.Kinects[0];
20: _kinect.Initialize(RuntimeOptions.UseDepthAndPlayerIndex |
21: RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor);
22:
23: _kinect.VideoStream.Open(ImageStreamType.Video, 2,
24: ImageResolution.Resolution640x480, ImageType.Color);
25: _kinect.DepthStream.Open(ImageStreamType.Depth, 2,
26: ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex);
27: _kinect.SkeletonFrameReady += KinectSkeletonFrameReady;
28: }
En este ejemplo no he puesto ningún tipo de gestión de excepciones, trabajando con una Beta deberíamos agregar algo después.
5. A continuación sólo nos queda pintar nuestro esqueleto en Kinect. Para esto utilizaremos la colección de Joints que nos retorna el Runtime y en el evento KinectSkeletonFrameReady pintaremos los Joints y los Bones que unen los mismos.
1: void KinectSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
2: {
3: foreach (var skeleton in
4: e.SkeletonFrame.Skeletons.Where
5: (skeleton =>
6: SkeletonTrackingState.Tracked == skeleton.TrackingState))
7: {
8: Skeleton.Children.Clear();
9: PaintBones(skeleton);
10: PaintJoints(skeleton);
11: }
12: }
6. Obviamente para que funcione la rutina anterior hace falta la implementación de PaintJoins y de PaintBones. Como pueden ver en el siguiente fragmento de código, es bastante simple ya que solo se recorren las colecciones y se pinta a partir de las mismas.
1: private void PaintJoints(SkeletonData skeleton)
2: {
3: foreach (Joint joint in skeleton.Joints)
4: {
5: var jointPos = _kinectCanvas.GetDisplayPosition(joint);
6: var jointLine = new Line
7: {
8: X1 = jointPos.X - 3
9: };
10: jointLine.X2 = jointLine.X1 + 6;
11: jointLine.Y1 = jointLine.Y2 = jointPos.Y;
12: jointLine.Stroke = KinectCanvas.JointColors[joint.ID];
13: jointLine.StrokeThickness = 6;
14: Skeleton.Children.Add(jointLine);
15: }
16: }
17:
18: private void PaintBones(SkeletonData skeleton)
19: {
20: var brush = new SolidColorBrush(Colors.Yellow);
21: Skeleton.Children.Add(_kinectCanvas.GetBodySegment
22: (skeleton.Joints, brush, JointID.HipCenter,
23: JointID.Spine, JointID.ShoulderCenter, JointID.Head));
24: Skeleton.Children.Add(_kinectCanvas.GetBodySegment
25: (skeleton.Joints, brush, JointID.ShoulderCenter,
26: JointID.ShoulderLeft, JointID.ElbowLeft, JointID.WristLeft, JointID.HandLeft));
27: Skeleton.Children.Add(_kinectCanvas.GetBodySegment
28: (skeleton.Joints, brush, JointID.ShoulderCenter,
29: JointID.ShoulderRight, JointID.ElbowRight, JointID.WristRight, JointID.HandRight));
30: Skeleton.Children.Add(_kinectCanvas.GetBodySegment
31: (skeleton.Joints, brush, JointID.HipCenter, JointID.HipLeft,
32: JointID.KneeLeft, JointID.AnkleLeft, JointID.FootLeft));
33: Skeleton.Children.Add(_kinectCanvas.GetBodySegment
34: (skeleton.Joints, brush, JointID.HipCenter, JointID.HipRight,
35: JointID.KneeRight, JointID.AnkleRight, JointID.FootRight));
36: }
En el ejemplo completo pueden ver la clase KinectCanvas() que es la que posee las definiciones para convertir joints en points y bones en lineas.
7. Si ejecutamos la aplicación y somos rápidos para sacar un screenshot podremos algo similar a
El ejemplo completo se puede descargar desde
Saludos @ Here
El Bruno
[# 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
[# TFS2010] HowTo: Add a new mapping between Microsoft Project and Team Foundation Server fields
Publicado por elbruno en HowTo, Team Foundation Server, Tutorial, WorkItemTracking el 13 septiembre, 2011
Good,
today a tutorial type post to show how to synchronize a Microsoft Project field with a field of a definition of a WorkItem of Team Foundation Server. For this example I added a field to the definition of a Task called “ElBruno.WbsCode” (if you don’t know how to do this post can help you). The idea for this post is to synchronize Microsoft Project WBS with this new field of the Task field.
For this we follow the following steps.
Tutorial
1. Open a command prompt in Visual Studio 2010.
2. Download the file mapping with a command similar to the following:
C:\Program Files (x 86) \Microsoft Visual Studio 10. 0\VC > tfsfieldmapping download /collection:http://W7-brunoc:8080/TFS/TPC “ /teamproject:A02 /mappingfile:”C:\mappingfile.xml “
THE syntax and the steps can be found here.
3. Edit the file we downloaded and add the mapping between the 2 fields that we are working. In this case it is in line 20 where the mapping is defined. An important detail is that the fields in Microsoft Project, it is necessary to put the prefix “pjTask” before the name of the same.
1: <?xml version="1.0" encoding="utf-8"?>
2: <MSProject>
3: <Mappings>
4: <Mapping WorkItemTrackingFieldReferenceName="System.AreaPath" ProjectField="pjTaskOutlineCode9" />
5: <Mapping WorkItemTrackingFieldReferenceName="System.AssignedTo" ProjectField="pjTaskResourceNames" />
6: <Mapping WorkItemTrackingFieldReferenceName="System.Id" ProjectField="pjTaskText10" ProjectName="Work Item ID" />
7: <Mapping WorkItemTrackingFieldReferenceName="System.IterationPath" ProjectField="pjTaskOutlineCode10" />
8: <Mapping WorkItemTrackingFieldReferenceName="System.Reason" ProjectField="pjTaskText14" />
9: <Mapping WorkItemTrackingFieldReferenceName="System.Rev" ProjectField="pjTaskText23" />
10: <Mapping WorkItemTrackingFieldReferenceName="System.State" ProjectField="pjTaskText13" ProjectName="State" />
11: <Mapping WorkItemTrackingFieldReferenceName="System.Title" ProjectField="pjTaskName" />
12: <Mapping WorkItemTrackingFieldReferenceName="System.WorkItemType" ProjectField="pjTaskText24" />
13: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Common.Priority" ProjectField="pjTaskText19" ProjectName="Work Item Priority" />
14: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Common.StackRank" ProjectField="pjTaskNumber1" />
15: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.CompletedWork" ProjectField="pjTaskActualWork" ProjectUnits="pjHour" IfSummaryRefreshOnly="true" />
16: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.FinishDate" ProjectField="pjTaskFinish" PublishOnly="true" />
17: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.OriginalEstimate" ProjectField="pjTaskBaselineWork" ProjectUnits="pjHour" IfSummaryRefreshOnly="true" />
18: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.RemainingWork" ProjectField="pjTaskRemainingWork" ProjectUnits="pjHour" IfSummaryRefreshOnly="true" />
19: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.StartDate" ProjectField="pjTaskStart" PublishOnly="true" />
20: <Mapping WorkItemTrackingFieldReferenceName="ElBruno.WbsCode" ProjectField="pjTaskWBS" PublishOnly="true" />
21: <LinksField ProjectField="pjTaskText26" />
22: <SyncField ProjectField="pjTaskText25" />
23: </Mappings>
24: </MSProject>
4. Now must climb this definition of mappings again our TFS server for this use the following command:
C:\Program Files (x 86) \Microsoft Visual Studio 10. 0\VC > tfsfieldmapping upload /collection:http://W7-brunoc:8080/TFS/TPC “ /teamproject:A02 /mappingfile:”C:\mappingfile.xml “
5 Done!
6. If now modify these tasks from Microsoft Project, as shown in the image below
When we sincronizemos them with TFS, we can already see the Microsoft Project WBS field in the “ElBruno.WbsCode” field of the Task.
Greetings @ Home
The Bruno
[#TFS2010] HowTo: Agregar un nuevo mapeo entre campos de Microsoft Project y Team Foundation Server
Publicado por elbruno en HowTo, Team Foundation Server, Tutorial, WorkItemTracking el 13 septiembre, 2011
Buenas,
hoy un post tipo tutorial para mostrar como sincronizar un campo de Microsoft Project con un campo de una definición de un WorkItem de Team Foundation Server. Para este ejemplo he agregado un campo a la definición de una Task que se llama “ElBruno.WbsCode” (si no sabes como hacerlo este post te puede ayudar). La idea para este post es sincronizar el campo de Microsoft Project WBS con este nuevo campo de la Task.
Para esto seguiremos los siguientes pasos.
Tutorial
1. Abrir una consola de comandos de Visual Studio 2010.
2. Descargar el archivo de mapeo con un comando similar al siguiente:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>tfsfieldmapping download /collection:http://w7-brunoc:8080/tfs/tpc /teamproject:A02 /mappingfile:"C:\mappingfile.xml"
LA sintaxis y los pasos los puedes encontrar aquí.
3. Editar el archivo que hemos descargado y agregar el mapeo entre los 2 campos con los que estamos trabajando. En este caso es en la línea 20 en donde se define el mapeo. Un detalle importante es que para los campos de Microsoft Project, es necesario poner el prefijo “pjTask” antes del nombre del mismo.
1: <?xml version="1.0" encoding="utf-8"?>
2: <MSProject>
3: <Mappings>
4: <Mapping WorkItemTrackingFieldReferenceName="System.AreaPath" ProjectField="pjTaskOutlineCode9" />
5: <Mapping WorkItemTrackingFieldReferenceName="System.AssignedTo" ProjectField="pjTaskResourceNames" />
6: <Mapping WorkItemTrackingFieldReferenceName="System.Id" ProjectField="pjTaskText10" ProjectName="Work Item ID" />
7: <Mapping WorkItemTrackingFieldReferenceName="System.IterationPath" ProjectField="pjTaskOutlineCode10" />
8: <Mapping WorkItemTrackingFieldReferenceName="System.Reason" ProjectField="pjTaskText14" />
9: <Mapping WorkItemTrackingFieldReferenceName="System.Rev" ProjectField="pjTaskText23" />
10: <Mapping WorkItemTrackingFieldReferenceName="System.State" ProjectField="pjTaskText13" ProjectName="State" />
11: <Mapping WorkItemTrackingFieldReferenceName="System.Title" ProjectField="pjTaskName" />
12: <Mapping WorkItemTrackingFieldReferenceName="System.WorkItemType" ProjectField="pjTaskText24" />
13: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Common.Priority" ProjectField="pjTaskText19" ProjectName="Work Item Priority" />
14: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Common.StackRank" ProjectField="pjTaskNumber1" />
15: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.CompletedWork" ProjectField="pjTaskActualWork" ProjectUnits="pjHour" IfSummaryRefreshOnly="true" />
16: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.FinishDate" ProjectField="pjTaskFinish" PublishOnly="true" />
17: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.OriginalEstimate" ProjectField="pjTaskBaselineWork" ProjectUnits="pjHour" IfSummaryRefreshOnly="true" />
18: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.RemainingWork" ProjectField="pjTaskRemainingWork" ProjectUnits="pjHour" IfSummaryRefreshOnly="true" />
19: <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.StartDate" ProjectField="pjTaskStart" PublishOnly="true" />
20: <Mapping WorkItemTrackingFieldReferenceName="ElBruno.WbsCode" ProjectField="pjTaskWBS" PublishOnly="true" />
21: <LinksField ProjectField="pjTaskText26" />
22: <SyncField ProjectField="pjTaskText25" />
23: </Mappings>
24: </MSProject>
4. Ahora debemos subir esta definición de mapeos nuevamente a nuestro servidor TFS, para esto utilizamos el siguiente comando:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>tfsfieldmapping upload /collection:http://w7-brunoc:8080/tfs/tpc /teamproject:A02 /mappingfile:"C:\mappingfile.xml"
5. Done !!!
6. Si ahora modificamos estas tareas desde Microsoft Project, como muestra la siguiente imagen
cuando sincronizemos las mismas con TFS, ya podremos ver el campo de Microsoft Project WBS, en el campo “ElBruno.WbsCode” de la Task.
Saludos @ Home
El Bruno








SocialVibe