Archive for category Kinect
[#KINECTSDK] Kinect SDK 1.5 and Developer Toolkit Released!
Publicado por elbruno en EnglishPost, Kinect, KinectSdk el 21 mayo, 2012
Buenas,
let’s go with one of the good news of the day:
The Kinect 1.5 SDK and developer Toolkit have been released.
In this case the download is split into these two components where it is no longer necessary to install the SDK with all the samples, but that if we are developers, because we will have our own set of tools.
Now that we can already buy Kinect in several countries (including Spain), we find that other 15 countries are added to the list. But in reality what we care about are the new features included in this version. We go with the most important
- Kinect Studio. A tool that allows you to record and play a sequence of actions against the sensor. Essential to avoid having to stand and take a unitary test human everytime you change something in an application.
- The Guide to developing applications for applications with Kinect. Essential 70 pages with many details to take into account for developments with Kinect.
- Face Tracking, facial recognition capabilities. Beware, this is not identify faces, but identify the points of a face. With a little work we recognize smiles, surprises, shocks, etc.
- Detection of points of skeleton in people seated. This is amazing, the ability to detect the upper joints of a skeleton but people seated, really opens another range of possibilities of applications.
- The camera now supports a resolution of 640 x 480 at 30 fps, with improvements in low-light environments.
- Cool! Joint orientation! We not only the position of a Joint, but that we also have the ability to see the "orientation" of the same.
- New languages for speech recognition: French, Spanish, Italian and Japanese.
Well now it try those things to which we had no access without the Beta SDK and post details on it ![]()
Saludos @ Home
El Bruno
[#KINECTSDK] Kinect SDK 1.5 and Developer Toolkit Released !!!
Buenas,
pues una de las buenas noticias del día:
El SDK de Kinect 1.5 y el developer Toolkit han sido liberados.
En este caso la descarga se separa en estos dos componentes donde ya no es necesario instalar el SDK con todos los samples, sino que si somos developers, pues tendremos nuestro propio set de herramientas.
Ahora que ya podemos comprar Kinect en varios países (incluido España), nos encontramos con que a la lista se añaden otros 15 países. Pero en realidad lo que más nos importa son las new features que se incluyen en esta versión. Vamos con las más importantes
- Kinect Studio. Una herramienta que te permite grabar y reproducir una secuencia de acciones frente al sensor. Fundamental para evitar tener que pararte y realizar una prueba unitaria humana cada vez que cambias algo en una aplicación.
- La Guía de desarrollo de aplicaciones para aplicaciones con Kinect. Imprescindibles 70 páginas con muchos detalles a tener en cuenta para desarrollos con Kinect.
- Face Tracking, capacidades de reconocimiento facial. Ojo, esto no es identificar rostros, sino identificar los puntos de un rostro. Con un poco de trabajo podremos reconocer sonrisas, sorpresas, sustos, etc.
- Detección de puntos de skeleton en personas sentadas. Esto es asombroso, la capacidad de detectar los joints superiores de un skeleton pero en personas sentadas, realmente abre otro abanico de posibilidades de aplicaciones.
- La cámara ahora soporta una resolución de 640 x 480 a 30FPS, con mejoras en ambientes con poca luz.
- Cool! Joint orientation !! no solo tenemos la posición de un Joint, sino que además tenemos la capacidad de ver la “orientación” del mismo.
- Nuevos lenguajes para el reconocimiento de voz: Francés, Español, Italiano y Japonés.
Bueno ahora toca probar aquellas cosas a las que no teníamos acceso sin las betas del SDK y a postear detalles sobre el mismo ![]()
Saludos @ Home
El Bruno
[#KINECT] Angry Mouse … ;)
Publicado por elbruno en EnglishPost, Kinect, Opinion, User Experience el 1 mayo, 2012
Good.
If I were a mouse or mouse would be quite angry / upset / angry or whatever you want in your land. Now comes a device more or less €100 expensive called Microsoft Kinect that aims to replace me and dethrone me in the world of computers. But of course, the anger / anger / anger begins already some time ago, when some guys from a company with a manzanita, reinvent a mobile phone a little big, put iPad name and everyone gets used to
Touch and drag instead of move and click
Then why, if a mouse I would be very angry. But as said the great Groucho Marx
It is better to remain silent and appear stupid than talk and remove doubts definitively.
That’s why that mouse still quietly accompanied by more than one and I think it will take quite some time so definitely leaves us.
Especially when there are many people who, at the time is to create a new user interface, which seek to replace the mouse, for example with gestures and actions about Kinect. These projects are designed and destined to fail in 99.99% of cases.
The key to these cases is in the word "create". What we must do is to leave alone the mouse, thank you for the services provided and start thinking what are the most effective ways of working with the new sensors that we possess.
Now the interaction between most mobile devices, tactile surfaces, as Kinect gestures detectors, pico projectors, etc.; It makes us think in new scenarios for applications that can really be great or disastrous.
Some will ask, you little sleep has affected the Bruno or what he writes this?, is very simple. As some have noticed that I like to play with Kinect and such devices, many times I get questions like
- How can I do to replace the mouse with Kinect?
- Not be how to double click with Kinect, when I try to replace the mouse.
And while it is true that I try to answer everything what you ask me, for those questions the answer this post. Where I do not respond nothing in particular but… well now you know.
I Luckily, have not only the opportunity to "play" with these devices but they are also part of my job at Avanade, so I can see the good and bad experiences in the world of the NUI (term beater to describe natural forms of work with electronic devices). Many people don’t realize that Kinect, for example, need considerable to be effective space, or that on a touch device because the sensitivity of the touch is not the same as a mouse.
Finally, a fact to keep in mind:
During the year 2008 the number of devices connected to the internet surpassed the number of people on Earth. By 2020 it is expected to be more than 50 billion devices connected to the internet. (Source ))
Does this mean?, which in addition to having a Mustang 100% connected to the internet, we will now have to interact with many types of new devices and of course, our friend the mouse will not be there to help us and is not a question that we emulate the functioning of mouse everywhere.
So I do not keep my mouse right now, but already begin to see how that can work in different spaces without a mouse… then I will see that device gives me the best help in that scenario ![]()
By the way
1 As the layman has been me boy, wait to see what I’m doing with my RX8, a Kinect, a tablet with Windows 8, etc. limitedin the hands of a piece of code C#. My girl is a little scared but the Valentino super happy to play with the car from a tablet… ![]()
.2 The ratonazo angry / upset / angry took out it of http://abstract.desktopnexus.com/get/134212?t=08tt07vgrel6eo8knisme46jh34fa00c9fcba2b
Saludos @ Home
El Bruno
[#KINECT] Y los ratones enfadados … ;)
Publicado por elbruno en Kinect, Opinion, User Experience el 1 mayo, 2012
Buenas.
Si yo fuese un ratón o mouse estaría bastante cabreado / enfadado / enojado o como se diga en tu tierra. Resulta que ahora llega un dispositivo de más o menos €100 llamado Microsoft Kinect que apunta a reemplazarme y destronarme en el mundo de los ordenadores. Pero claro, el cabreo / enfado / enojo ya comienza hace un tiempo, cuando unos tíos de una empresa con una manzanita, reinventan un teléfono móvil un poco grande, le ponen de nombre iPad y todo el mundo se acostumbra a
Tocar y arrastrar en lugar de mover y clicar
Pues por eso, si fuese un ratón estaría muy cabreado. Pero como dice el gran Groucho Marx
Es mejor permanecer callado y parecer tonto que hablar y despejar las dudas definitivamente.
Es por eso que el ratón sigue calladito acompañado a más de uno y creo que tardará bastante tiempo para que nos abandone definitivamente.
Especialmente cuando hay muchas personas que, al momento de crear una nueva interfaz de usuario, lo que intentan es reemplazar el ratón, por ejemplo con gestos y acciones de Kinect. Estos proyectos están orientados y destinados al fracaso en un 99,99% de los casos.
La clave de estos casos está en la palabra “crear”. Lo que debemos hacer es dejar en paz al ratón, agradecerle los servicios prestados y comenzar a pensar cuáles son las formas más efectivas de trabajo con los nuevos sensores que poseemos.
Ahora la interacción entre dispositivos cada vez más móviles, superficies táctiles, detectores de gestos como Kinect, pico proyectores, etc.; hace que podamos pensar en nuevos escenarios para aplicaciones que realmente pueden ser grandiosos o desastrosos.
Alguno se preguntará, ¿le ha afectado el poco sueño al Bruno o qué le pasa que escribe esto?, es muy simple. Como algunos se han dado cuenta que me gusta jugar con Kinect y con este tipo de dispositivos, muchas veces me llegan preguntas del tipo
- ¿Cómo puedo hacer para reemplazar el ratón con Kinect?
- No se cómo hacer un doble clic con Kinect, cuando intento reemplazar al ratón.
Y si bien es cierto que intento responder todo lo que me preguntan, para esas preguntas la respuesta será este post. Donde no respondo nada en concreto pero … bueno ya sabes.
Yo por suerte, no solo tengo la oportunidad de “jugar” con estos dispositivos sino que además son parte de mi trabajo en Avanade, con lo que puedo ver las buenas y malas experiencias en el mundo de las NUI (término molón para describir formas naturales de trabajo frente a dispositivos electrónicos). Muchas personas no se dan cuenta que Kinect, por ejemplo, necesita un espacio considerable para ser efectivo, o que en un dispositivo táctil pues la sensibilidad del touch no es la misma que un ratón.
Finalmente, un dato a tener en cuenta:
Durante el año 2008 la cantidad de dispositivos conectados a internet superó a la cantidad de personas en la tierra. Para el año 2020 se espera que haya más de 50 billones de dispositivos conectados a internet. (Fuente)
Esto qué significa?, que además de tener un Mustang 100% conectado a internet, ahora tendremos que interactuar con muchos tipos de dispositivos nuevos y claro, nuestro amigo el mouse no estará allí para ayudarnos y tampoco es cuestión de que emulemos el funcionamiento del mouse en todas partes.
Así que, yo no guardaré mi mouse ya mismo, pero ya comenzaré a ver de que forma puedo trabajar en diferentes espacios sin un mouse … luego veré que dispositivo me brinda la mejor ayuda en ese escenario ![]()
Por cierto
1. Como el Lego me ha quedado chico, espera a ver lo que estoy haciendo con mi RX8, un Kinect, una tableta con Windows 8, etc. 230CV en manos de una porción de código C#. Mi chica está un poco asustada pero el Valentino súper feliz de poder jugar con el coche desde una tableta … ![]()
.2 El ratonazo cabreado / enfadado / enojado lo saqué de http://abstract.desktopnexus.com/get/134212?t=08tt07vgrel6eo8knisme46jh34fa00c9fcba2b
Saludos @ Home
El Bruno
[# VIDEO] Magic with Kinect (augmented reallity)
Publicado por elbruno en EnglishPost, Kinect, KinectSdk, Video el 28 abril, 2012
Buenas,
After a couple of hours playing Kinect Star Wars with Valentino, hurts body parts that did not know. So this week is a bit of return to ALM, because I start a video that has absolutely nothing to do with ALM, but that is impressive in what refers to deployment of assets.
Link: http://youtu.be/C4pHP-pgwlI
The interesting thing about the video is that it is a technology that most of us could implement and create in our own House. I already have been "playing" with a bit of reality augmented with Kinect and the truth is that while it does need to know a little of how the images in general, is not so complicated.
This a few years ago was crazy just thinking, but thanks to Kinect and Kinect SDK, then what we now have easier.Impressive, is not it?
Saludos @ Home
El Bruno
[#VIDEO] Magia con Kinect (augmented reallity)
Buenas,
después de un par de horas de jugar a Kinect Star Wars con Valentino, me duelen partes del cuerpo que no conocía. Así que en esta semana que es un poco de retorno a ALM, pues empiezo por un video que no tiene absolutamente nada que ver con ALM, pero que es impresionante en lo que se refiere a despliegue de medios.
Link: http://youtu.be/C4pHP-pgwlI
Lo más interesante del video, es que es una tecnología que la mayoría de nosotros podríamos implementar y crear en nuestra propia casa. Yo ya he estado “jugando” con un poco de realidad aumentada con Kinect y la verdad es que si bien hace falta conocer un poco de como funcionan las imágenes en general, no es tan complicado.
Esto hace unos años era una locura de solo pensarlo, pero ahora gracias a Kinect y al Kinect SDK, pues lo tenemos más fácil. Impresionante, ¿no?
Saludos @ Home
El Bruno
[#KINECTSDK] Kinect Missile Launcher (V): Video and source code
Publicado por elbruno en EnglishPost, KinectSdk, Video, Visual Studio 11 el 27 abril, 2012
Buenas,
First we go with the links of the series
- Identifying the Missile Launcher
- Moving the Rocket missile launcher
- Another wayt to find out the values to work in C# with the rocket launcher
- Using the Rocket Launcher with Kinect
- Video and Source code
And now a video of 30 seconds where I show you a small example of the application running
Link: http://youtu.be/ATxtYes6pBQ
Disclaimer: when I fire the missile, it comes with a power like a HALO gun, so the few frames per second of the Kinect camera can not capture the missile on its flight. I also put the missile rocket launcher in front of the Kinect camera to record the video, so the capture of the skeleton goes a bit bad, and perform some strange recognitions in the video.
And finally, the code source of the application can be downloaded from https://skydrive.live.com/redir.aspx?cid=bef06dffdb192125 & SPL = BEF06DFFDB192125! 4275 & parid = BEF06DFFDB192125! 1932 & authkey =!AOhNmp_md8XLYbo
Saludos @ Home
El Bruno
[#KINECTSDK] Kinect Missile Launcher (V): Video y codigo fuente
Publicado por elbruno en Code Sample, Kinect, KinectSdk, Video, Visual Studio 11 el 27 abril, 2012
Buenas.
Primero vamos con los links de la serie
- Identificando el dispositivo HID
- Moviendo el lanza misiles
- Otra forma de averiguar los valores para trabajar con el lanza misiles con C#
- Controlando el lanza misiles con Kinect
- Video y código fuente de ejemplo
Y ahora un video de 30 segundos donde muestro un pequeño ejemplo de la aplicación en funcionamiento.
Link : http://youtu.be/ATxtYes6pBQ
Un detalle, el misil sale con una potencia que ni en HALO, con lo que los pocos frames de la cámara de Kinect no lo pueden capturar en su vuelo. Otro detalle es que como puse el lanza misiles delante del Kinect para poder grabar el video, la captura del skeleton va un poco así así, con lo que puede hacer unos raros.
Y para terminar, el código fuente de la aplicación se puede descargar desde https://skydrive.live.com/redir.aspx?cid=bef06dffdb192125&resid=BEF06DFFDB192125!4275&parid=BEF06DFFDB192125!1932&authkey=!AOhNmp_md8XLYbo
Saludos @ Home
El Bruno
[#KINECTSDK] Kinect Missile Launcher (IV): Using the Rocket Launcher with Kinect
Publicado por elbruno en Code Sample, EnglishPost, KinectSdk, Visual Studio 11 el 26 abril, 2012
Buenas,
today already we will create an application that allows us to control the Lance missiles using Kinect gestures. For this I have thought of the following controls
- The right hand controls the direction of the Lance missiles. You can go to the right, left, up or down.
- The left hand controls the firing of the missile, shoot is raise your hand above the head.
- If both hands are below the waist stop movements of the Lance missile
On this basis, and taking advantage of Visual controls of "Microsoft.Samples.Kinect.WpfViewers" I created a WPF application with the following code in the main window
1: using System.Linq;
2: using System.Windows;
3: using Microsoft.Kinect;
4:
5: namespace ElBruno.Rocket.Ui
6: {
7: public partial class MainWindow
8: {
9: private KinectSensor _sensor;
10: private Rocket _rocket;
11: public MainWindow()
12: {
13: InitializeComponent();
14: Loaded += MainWindowLoaded;
15: }
16:
17: private void MainWindowLoaded(object sender, RoutedEventArgs e)
18: {
19: InitRocket();
20: InitKinectSensor();
21: }
22:
23: private void InitRocket()
24: {
25: _rocket = new Rocket(@"vid_0a81", @"pid_ff01");
26: _rocket.Connect();
27: }
28:
29: private void InitKinectSensor()
30: {
31: // validate
32: if (KinectSensor.KinectSensors.Count == 0) return;
33:
34: // init Kinect
35: var parameters = new TransformSmoothParameters
36: {
37: Smoothing = 0.75f,
38: Correction = 0.1f,
39: Prediction = 0.0f,
40: JitterRadius = 0.05f,
41: MaxDeviationRadius = 0.08f
42: };
43:
44: _sensor = KinectSensor.KinectSensors[0];
45: _sensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
46: _sensor.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);
47: _sensor.SkeletonStream.Enable(parameters);
48: _sensor.Start();
49: colorViewer.Kinect = _sensor;
50: skeletonViewer.Kinect = _sensor;
51: _sensor.SkeletonFrameReady += SensorSkeletonFrameReady;
52: }
53:
54: private void SensorSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
55: {
56: Skeleton[] skeletons = null;
57: using (var frame = e.OpenSkeletonFrame())
58: {
59: if (frame != null)
60: {
61: skeletons = new Skeleton[frame.SkeletonArrayLength];
62: frame.CopySkeletonDataTo(skeletons);
63: }
64: }
65:
66: if (skeletons == null) return;
67:
68: foreach (var kinectRocketGestures in (
69: from skeleton in skeletons
70: where skeleton.TrackingState == SkeletonTrackingState.Tracked
71: let headJoint = skeleton.Joints[JointType.Head]
72: where headJoint.TrackingState != JointTrackingState.NotTracked
73: select skeleton).Select(skeleton => new KinectRocketGestures(skeleton, _rocket)))
74: {
75: var gesture = kinectRocketGestures.ValidateGestures();
76: textBlockInformation.Text = gesture;
77: }
78: }
79: }
80: }
It is important to note that this window has almost nothing interesting logic only starts the sensors of the Kinect and the Lance missiles and then subscribe to the skeleton update notifications.
In this notification (line 54), it validates that the tracking of the skeleton is correct and then we use a class KinectRocketGestures that is what makes a little magic between Kinect and the Lance missiles.
This class code is as follows
1: using Microsoft.Kinect;
2:
3: namespace ElBruno.Rocket.Ui
4: {
5: class KinectRocketGestures
6: {
7: private readonly Skeleton _skeleton;
8: private readonly Rocket _rocket;
9:
10: public KinectRocketGestures(Skeleton skeleton, Rocket rocket)
11: {
12: _skeleton = skeleton;
13: _rocket = rocket;
14: }
15:
16: public string ValidateGestures()
17: {
18: var gesture = @"Not defined";
19: // STOP
20: // Right hand and Left hand hanging at the side
21: if (_skeleton.Joints[JointType.HandRight].Position.Y < _skeleton.Joints[JointType.HipCenter].Position.Y &&
22: _skeleton.Joints[JointType.HandLeft].Position.Y < _skeleton.Joints[JointType.HipCenter].Position.Y)
23: {
24: _rocket.StopAll();
25: _rocket.StopFiring();
26: _rocket.StopMovements();
27: gesture = @"STOP";
28: return gesture;
29: }
30:
31: // FIRE
32: if (_skeleton.Joints[JointType.HandLeft].Position.Y > _skeleton.Joints[JointType.Head].Position.Y)
33: {
34: gesture = @"FIRE";
35: _rocket.FireOnce();
36: }
37:
38: // MOVE RIGHT OR LEFT
39: // Right hand in front of right shoulder
40: // Right hand below shoulder height but above hip height
41: if (
42: (_skeleton.Joints[JointType.HandRight].Position.Z < _skeleton.Joints[JointType.ElbowRight].Position.Z &&
43: _skeleton.Joints[JointType.HandLeft].Position.Y < _skeleton.Joints[JointType.HipCenter].Position.Y)
44: &&
45: (_skeleton.Joints[JointType.HandRight].Position.Y < _skeleton.Joints[JointType.Head].Position.Y &&
46: _skeleton.Joints[JointType.HandRight].Position.Y > _skeleton.Joints[JointType.HipCenter].Position.Y)
47: )
48: {
49: // Right hand right of right shoulder
50: if (_skeleton.Joints[JointType.HandRight].Position.X > _skeleton.Joints[JointType.ShoulderRight].Position.X)
51: {
52: gesture = @"MOVE RIGHT";
53: _rocket.MoveRight();
54: }
55: // Right hand left of left Shoulder
56: if (_skeleton.Joints[JointType.HandRight].Position.X < _skeleton.Joints[JointType.ShoulderLeft].Position.X)
57: {
58: gesture = @"MOVE LEFT";
59: _rocket.MoveLeft();
60: }
61: }
62:
63: // MOVE UP OR DOWN
64: // Right hand in front of body with Left hand hanging at the side
65: // Right hand between shoulders
66: if (
67: (_skeleton.Joints[JointType.HandRight].Position.Z < _skeleton.Joints[JointType.ShoulderCenter].Position.Z &&
68: _skeleton.Joints[JointType.HandLeft].Position.Y < _skeleton.Joints[JointType.HipCenter].Position.Y)
69: &&
70: (_skeleton.Joints[JointType.HandRight].Position.X < _skeleton.Joints[JointType.ShoulderRight].Position.X &&
71: _skeleton.Joints[JointType.HandRight].Position.X > _skeleton.Joints[JointType.ShoulderLeft].Position.X)
72: )
73: {
74: // Right hand above the shoulders
75: if (_skeleton.Joints[JointType.HandRight].Position.Y > _skeleton.Joints[JointType.ShoulderCenter].Position.Y)
76: {
77: gesture = @"MOVE UP";
78: _rocket.MoveUp();
79: }
80: // Right hand below the chest/gut
81: if (_skeleton.Joints[JointType.HandRight].Position.Y < _skeleton.Joints[JointType.Spine].Position.Y)
82: {
83: gesture = @"MOVE DOWN";
84: _rocket.MoveDown();
85: }
86: return gesture;
87: }
88: }
89: }
90: }
And that’s it! A bit of validation of the right hand and left hand positions and have control of the Lance missiles using Kinect.
Now I’m going fast to the MadridDotNet event and in the next post I put a video and the example of the application code.
Saludos @ La Finca
El Bruno
[#KINECTSDK] Kinect Missile Launcher (IV): Controlando el lanza misiles con Kinect
Publicado por elbruno en Code Sample, KinectSdk, Visual Studio 11 el 26 abril, 2012
Buenas,
hoy ya vamos a crear una aplicación que nos permita controlar el lanza misiles utilizando gestos de Kinect. Para esto he pensado en los siguientes controles
- La mano derecha controla la dirección del lanza misiles. Puede ir a la derecha, a la izquierda, arriba o abajo.
- La mano izquierda controla el disparo del misil, la forma de disparar es levantar la mano encima de la cabeza.
- Si ambos manos están por debajo de la cintura se detienen los movimientos del lanza misiles
Con esta base, y aprovechando los controles visuales de “Microsoft.Samples.Kinect.WpfViewers” he creado una aplicación WPF con el siguiente código en la ventana principal
1: using System.Linq;
2: using System.Windows;
3: using Microsoft.Kinect;
4:
5: namespace ElBruno.Rocket.Ui
6: {
7: public partial class MainWindow
8: {
9: private KinectSensor _sensor;
10: private Rocket _rocket;
11: public MainWindow()
12: {
13: InitializeComponent();
14: Loaded += MainWindowLoaded;
15: }
16:
17: private void MainWindowLoaded(object sender, RoutedEventArgs e)
18: {
19: InitRocket();
20: InitKinectSensor();
21: }
22:
23: private void InitRocket()
24: {
25: _rocket = new Rocket(@"vid_0a81", @"pid_ff01");
26: _rocket.Connect();
27: }
28:
29: private void InitKinectSensor()
30: {
31: // validate
32: if (KinectSensor.KinectSensors.Count == 0) return;
33:
34: // init Kinect
35: var parameters = new TransformSmoothParameters
36: {
37: Smoothing = 0.75f,
38: Correction = 0.1f,
39: Prediction = 0.0f,
40: JitterRadius = 0.05f,
41: MaxDeviationRadius = 0.08f
42: };
43:
44: _sensor = KinectSensor.KinectSensors[0];
45: _sensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
46: _sensor.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);
47: _sensor.SkeletonStream.Enable(parameters);
48: _sensor.Start();
49: colorViewer.Kinect = _sensor;
50: skeletonViewer.Kinect = _sensor;
51: _sensor.SkeletonFrameReady += SensorSkeletonFrameReady;
52: }
53:
54: private void SensorSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
55: {
56: Skeleton[] skeletons = null;
57: using (var frame = e.OpenSkeletonFrame())
58: {
59: if (frame != null)
60: {
61: skeletons = new Skeleton[frame.SkeletonArrayLength];
62: frame.CopySkeletonDataTo(skeletons);
63: }
64: }
65:
66: if (skeletons == null) return;
67:
68: foreach (var kinectRocketGestures in (
69: from skeleton in skeletons
70: where skeleton.TrackingState == SkeletonTrackingState.Tracked
71: let headJoint = skeleton.Joints[JointType.Head]
72: where headJoint.TrackingState != JointTrackingState.NotTracked
73: select skeleton).Select(skeleton => new KinectRocketGestures(skeleton, _rocket)))
74: {
75: var gesture = kinectRocketGestures.ValidateGestures();
76: textBlockInformation.Text = gesture;
77: }
78: }
79: }
80: }
1: using Microsoft.Kinect;
2:
3: namespace ElBruno.Rocket.Ui
4: {
5: class KinectRocketGestures
6: {
7: private readonly Skeleton _skeleton;
8: private readonly Rocket _rocket;
9:
10: public KinectRocketGestures(Skeleton skeleton, Rocket rocket)
11: {
12: _skeleton = skeleton;
13: _rocket = rocket;
14: }
15:
16: public string ValidateGestures()
17: {
18: var gesture = @"Not defined";
19: // STOP
20: // Right hand and Left hand hanging at the side
21: if (_skeleton.Joints[JointType.HandRight].Position.Y < _skeleton.Joints[JointType.HipCenter].Position.Y &&
22: _skeleton.Joints[JointType.HandLeft].Position.Y < _skeleton.Joints[JointType.HipCenter].Position.Y)
23: {
24: _rocket.StopAll();
25: _rocket.StopFiring();
26: _rocket.StopMovements();
27: gesture = @"STOP";
28: return gesture;
29: }
30:
31: // FIRE
32: if (_skeleton.Joints[JointType.HandLeft].Position.Y > _skeleton.Joints[JointType.Head].Position.Y)
33: {
34: gesture = @"FIRE";
35: _rocket.FireOnce();
36: }
37:
38: // MOVE RIGHT OR LEFT
39: // Right hand in front of right shoulder
40: // Right hand below shoulder height but above hip height
41: if (
42: (_skeleton.Joints[JointType.HandRight].Position.Z < _skeleton.Joints[JointType.ElbowRight].Position.Z &&
43: _skeleton.Joints[JointType.HandLeft].Position.Y < _skeleton.Joints[JointType.HipCenter].Position.Y)
44: &&
45: (_skeleton.Joints[JointType.HandRight].Position.Y < _skeleton.Joints[JointType.Head].Position.Y &&
46: _skeleton.Joints[JointType.HandRight].Position.Y > _skeleton.Joints[JointType.HipCenter].Position.Y)
47: )
48: {
49: // Right hand right of right shoulder
50: if (_skeleton.Joints[JointType.HandRight].Position.X > _skeleton.Joints[JointType.ShoulderRight].Position.X)
51: {
52: gesture = @"MOVE RIGHT";
53: _rocket.MoveRight();
54: }
55: // Right hand left of left Shoulder
56: if (_skeleton.Joints[JointType.HandRight].Position.X < _skeleton.Joints[JointType.ShoulderLeft].Position.X)
57: {
58: gesture = @"MOVE LEFT";
59: _rocket.MoveLeft();
60: }
61: }
62:
63: // MOVE UP OR DOWN
64: // Right hand in front of body with Left hand hanging at the side
65: // Right hand between shoulders
66: if (
67: (_skeleton.Joints[JointType.HandRight].Position.Z < _skeleton.Joints[JointType.ShoulderCenter].Position.Z &&
68: _skeleton.Joints[JointType.HandLeft].Position.Y < _skeleton.Joints[JointType.HipCenter].Position.Y)
69: &&
70: (_skeleton.Joints[JointType.HandRight].Position.X < _skeleton.Joints[JointType.ShoulderRight].Position.X &&
71: _skeleton.Joints[JointType.HandRight].Position.X > _skeleton.Joints[JointType.ShoulderLeft].Position.X)
72: )
73: {
74: // Right hand above the shoulders
75: if (_skeleton.Joints[JointType.HandRight].Position.Y > _skeleton.Joints[JointType.ShoulderCenter].Position.Y)
76: {
77: gesture = @"MOVE UP";
78: _rocket.MoveUp();
79: }
80: // Right hand below the chest/gut
81: if (_skeleton.Joints[JointType.HandRight].Position.Y < _skeleton.Joints[JointType.Spine].Position.Y)
82: {
83: gesture = @"MOVE DOWN";
84: _rocket.MoveDown();
85: }
86: return gesture;
87: }
88: }
89: }
90: }
Y listo! Un poco de validación de posiciones de la mano derecha y la mano izquierda y ya tenemos el control del lanza misiles utilizando Kinect.
Ahora me voy rápido al evento de MadridDotNet y en el próximo post pongo un video y el código de ejemplo de la aplicación.
Saludos @ La Finca
El Bruno




SocialVibe