1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
List<Joint> JointList = new List<Joint>();
List<float> JointsCordinates = new List<float>();
// chercher le squelette
if (first == null) // si pas de squelette
{
txtP.Text = "No skeleton";
return;
}
else
{
txtP.Text = "Skeleton Detected";
/// définir les 20 articulations
Joint H = first.Joints[JointType.Head]; // head
Joint SC = first.Joints[JointType.ShoulderCenter]; // shouldercenter
Joint SL = first.Joints[JointType.ShoulderLeft]; // shoulder Left
Joint SR = first.Joints[JointType.ShoulderRight]; // soulderRight
Joint EL = first.Joints[JointType.ElbowLeft];
Joint ER = first.Joints[JointType.ElbowRight];
Joint WL = first.Joints[JointType.WristLeft];
Joint WR = first.Joints[JointType.WristRight];
Joint HandL = first.Joints[JointType.HandLeft];
Joint HandR = first.Joints[JointType.HandRight];
Joint Spine = first.Joints[JointType.Spine];
Joint HipC = first.Joints[JointType.HipCenter];
Joint HipL = first.Joints[JointType.HipLeft];
Joint HipR = first.Joints[JointType.HipRight];
Joint KL = first.Joints[JointType.KneeLeft];
Joint KR = first.Joints[JointType.KneeRight];
Joint AnkL = first.Joints[JointType.AnkleLeft];
Joint AnkR = first.Joints[JointType.AnkleRight];
Joint FL = first.Joints[JointType.FootLeft];
Joint FR = first.Joints[JointType.FootRight];
// préparer une liste d'articulations pour l'afficher après dans la première colonne de a listeView
JointList.Add(H);
JointList.Add(SC);
JointList.Add(SL);
JointList.Add(SR);
JointList.Add(Spine);
JointList.Add(EL);
JointList.Add(ER);
JointList.Add(HandL);
JointList.Add(HandR);
JointList.Add(HipC);
JointList.Add(HipR);
JointList.Add(HipL);
JointList.Add(KL);
JointList.Add(KR);
JointList.Add(AnkL);
JointList.Add(AnkR);
JointList.Add(FL);
JointList.Add(FR);
JointList.Add(WL);
JointList.Add(WR);
// si une articulation est suivie alors on calcule ses coordonnées dans l'espace 3D
foreach (Joint j in JointList)
{
if (j.TrackingState == JointTrackingState.Tracked)
jx = j.Position.X;
jy = j.Position.Y;
jz = j.Position.Z;
// ajouter chaque cordonnée à la liste JointsCordinates pour l'afficher après dans les 3 colonnes qui restent
JointsCordinates.Add(jx);
JointsCordinates.Add(jy);
JointsCordinates.Add(jz);
}
} |
Partager