Archivos para 12/11/11

[# KINECT] HowTo: Paint 2 skeletons in a WPF Canvas

image

Good,

After the post yesterday where I showed as a painting on a Canvas a skeleton from the data provided to us by Kinect, I have received a couple of questions where you ask me as paint 2 skeletons.

As well to achieve something similar to the following images, all we need to change on the code of yesterday is the routine where Kinect tells us that it has detected a Skeleton. In this routine us encargábamos of painting it, because well we now do it this way:

   1: void KinectSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
   2: {
   3:     var skeletonId = 0;
   4:     Skeleton.Children.Clear();
   5:     foreach (var skeleton in e.SkeletonFrame.Skeletons.Where
   6:              (skeleton => 
   7:                        SkeletonTrackingState.Tracked == skeleton.TrackingState))
   8:     {
   9:         PaintBones(skeleton, KinectCanvas.SkeletonColors[skeletonId]);
  10:         PaintJoints(skeleton);
  11:         skeletonId++;
  12:     }
  13: }

The big difference is that for each Skeleton import a static color from a dictionary. Yellow and green for my taste.

   1: public static Dictionary<int, Color> SkeletonColors 
   2:         = new Dictionary<int, Color>
   3:           {
   4:             {0, Colors.Yellow},
   5:             {1, Colors.Green}
   6:           };

At this point we can already have a skeleton tracker to help us show a static pose:

image

Or a jump from a 2.

image

Previous images we can see how the Valentino me comes to her knees and the points of the Skeleton show detail interesting.

The example to download from

https://SkyDrive.live.com/embedicon.aspx/code%20Samples/2011%2011%2012%20-%20ElBruno.KinectSkeleton01.zip?CID=bef06dffdb192125 & sc = documents

Greetings @ Home

The Bruno

1 comentario

[#KINECT] HowTo: Pintar 2 skeletons en un Canvas WPF

image

Buenas,

después del post de ayer donde mostré como pintar en un Canvas un skeleton a partir de los datos que nos brinda Kinect, me han llegado un par de preguntas donde me preguntan como pintar 2 skeletons.

Pues bien para lograr algo similar a las siguientes imágenes, lo único que debemos modificar sobre el código de ayer es la rutina donde Kinect nos indica que ha detectado un Skeleton. En esta rutina nos encargábamos de pintar el mismo, pues bien ahora lo hacemos así:

   1: void KinectSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)

   2: {

   3:     var skeletonId = 0;

   4:     Skeleton.Children.Clear();

   5:     foreach (var skeleton in e.SkeletonFrame.Skeletons.Where

   6:              (skeleton => 

   7:                        SkeletonTrackingState.Tracked == skeleton.TrackingState))

   8:     {

   9:         PaintBones(skeleton, KinectCanvas.SkeletonColors[skeletonId]);

  10:         PaintJoints(skeleton);

  11:         skeletonId++;

  12:     }

  13: }

La gran diferencia está en que para cada Skeleton importamos un color estático desde un diccionario. Amarillo y verde para mi gusto.

   1: public static Dictionary<int, Color> SkeletonColors 

   2:         = new Dictionary<int, Color>

   3:           {

   4:             {0, Colors.Yellow},

   5:             {1, Colors.Green}

   6:           };

 

En este punto ya podremos tener un skeleton tracker que nos ayude a mostrar una pose estática:

image

O un salto de a 2.

image

Detalle interesante, en las imágenes anteriores podemos ver como el Valentino me llega hasta las rodillas y los puntos del Skeleton así lo demuestran.

El ejemplo para descargar desde

https://skydrive.live.com/embedicon.aspx/Code%20Samples/2011%2011%2012%20-%20ElBruno.KinectSkeleton01.zip?cid=bef06dffdb192125&sc=documents

 

Saludos @ Home

El Bruno

   

5 comentarios

Seguir

Get every new post delivered to your Inbox.

Únete a otros 898 seguidores