This is the code I use to record the points that includes a few computations. So yep, I get the value locations of the point, do some math, then save them to a list.
gesture.L.E.AddFrameDescriptor(
joints[JointType.ElbowLeft].Position.X, joints[JointType.ElbowLeft].Position.Y, joints[JointType.ElbowLeft].Position.Z,
joints[JointType.SpineMid].Position.X, joints[JointType.SpineMid].Position.Y, joints[JointType.SpineMid].Position.Z,
spineBaseShoulderRHO
);
gesture.L.W.AddFrameDescriptor(
joints[JointType.WristLeft].Position.X, joints[JointType.WristLeft].Position.Y, joints[JointType.WristLeft].Position.Z,
joints[JointType.SpineMid].Position.X, joints[JointType.SpineMid].Position.Y, joints[JointType.SpineMid].Position.Z,
spineBaseShoulderRHO
);
gesture.L.H.AddFrameDescriptor(
joints[JointType.HandTipLeft].Position.X, joints[JointType.HandTipLeft].Position.Y, joints[JointType.HandTipLeft].Position.Z,
joints[JointType.SpineMid].Position.X, joints[JointType.SpineMid].Position.Y, joints[JointType.SpineMid].Position.Z,
spineBaseShoulderRHO
);
gesture.R.E.AddFrameDescriptor(
joints[JointType.ElbowRight].Position.X, joints[JointType.ElbowRight].Position.Y, joints[JointType.ElbowRight].Position.Z,
joints[JointType.SpineMid].Position.X, joints[JointType.SpineMid].Position.Y, joints[JointType.SpineMid].Position.Z,
spineBaseShoulderRHO
);
gesture.R.W.AddFrameDescriptor(
joints[JointType.WristRight].Position.X, joints[JointType.WristRight].Position.Y, joints[JointType.WristRight].Position.Z,
joints[JointType.SpineMid].Position.X, joints[JointType.SpineMid].Position.Y, joints[JointType.SpineMid].Position.Z,
spineBaseShoulderRHO
);
gesture.R.H.AddFrameDescriptor(
joints[JointType.HandTipRight].Position.X, joints[JointType.HandTipRight].Position.Y, joints[JointType.HandTipRight].Position.Z,
joints[JointType.SpineMid].Position.X, joints[JointType.SpineMid].Position.Y, joints[JointType.SpineMid].Position.Z,
spineBaseShoulderRHO
);
For some reason I get a lot of repeated values, repeated for like 20 times. I've noticed if I saved only a single value, I get significant values and no more repetitions, plus the difference of the values are much closer to each other like 0.05513 then 0.05413 compared to those repeated once I get like twenty 0.05513 then the next is twenty 0.05013.
EDIT Here is the sample values I get if I store multiple values to a list.
0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.399695181 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401078759 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401423597 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625 0.401669625
As you can see the numbers are repeated like twenty times.
EXTENDED CODE
private void DrawBody(IReadOnlyDictionary<JointType, Joint> joints, IDictionary<JointType, Point> jointPoints, DrawingContext drawingContext, Pen drawingPen)
{
foreach (var bone in this.bones)
{
this.DrawBone(joints, jointPoints, bone.Item1, bone.Item2, drawingContext, drawingPen);
}
foreach (JointType jointType in joints.Keys)
{
if (!(jointType.Equals(JointType.HandLeft) || jointType.Equals(JointType.HandRight) || jointType.Equals(JointType.ThumbLeft) || jointType.Equals(JointType.ThumbRight)))
{
Brush drawBrush = null;
TrackingState trackingState = joints[jointType].TrackingState;
if (trackingState == TrackingState.Tracked)
{
drawBrush = this.trackedJointBrush;
check.Add(joints[JointType.ElbowLeft].Position.X);
if (this.status_active)
{
if (!this.status_ready && (new MathFunctions().GetDist2P(joints[JointType.HandTipLeft].Position.X, joints[JointType.HandTipRight].Position.X) <= 0.03 && joints[JointType.HandTipLeft].Position.Y < joints[JointType.SpineMid].Position.Y && joints[JointType.HandTipRight].Position.Y < joints[JointType.SpineMid].Position.Y))
{
lbl_status.Content = "READY"; lbl_status.Foreground = Brushes.Green; ellps_status.Fill = Brushes.Green;
this.status_ready = true;
}
else if (this.status_ready)
{
if (!this.status_recording && (joints[JointType.HandTipLeft].Position.Y > joints[JointType.SpineBase].Position.Y || joints[JointType.HandTipRight].Position.Y > joints[JointType.SpineBase].Position.Y))
{
lbl_status.Content = "RECORDING"; lbl_status.Foreground = Brushes.Red; ellps_status.Fill = Brushes.Red;
this.status_recording = true;
this.gesture = new Gesture();
spineBaseShoulderRHO = new MathFunctions().GetRho(
new MathFunctions().GetDist2P(joints[JointType.SpineBase].Position.X, joints[JointType.SpineShoulder].Position.X),
new MathFunctions().GetDist2P(joints[JointType.SpineBase].Position.Y, joints[JointType.SpineShoulder].Position.Y),
new MathFunctions().GetDist2P(joints[JointType.SpineBase].Position.Z, joints[JointType.SpineShoulder].Position.Z)
);
}
else if (status_recording)
{
if (joints[JointType.HandTipLeft].Position.Y < joints[JointType.SpineBase].Position.Y && joints[JointType.HandTipRight].Position.Y < joints[JointType.SpineBase].Position.Y)
{
lbl_status.Content = "ACTIVE"; lbl_status.Foreground = Brushes.Black; ellps_status.Fill = Brushes.Black;
this.status_active = true;
this.status_ready = false;
this.status_recording = false;
gesture = new SLFunctions().RemoveRedundantPoints(gesture);
// identify gesture
if (tbox_word.Text == "")
{
SimilarityIndex minIndex = new SLFunctions().IdentifyGesture(library, gesture);
lbl_word.Content = minIndex.gestureName;
}
// new gesture
else
{
gesture.name = tbox_word.Text;
new SLFunctions().SaveGesture(gesture, "library");
library.Add(gesture);
tbox_word.Text = "";
}
}
#region AddFrameDescriptor
gesture.L.E.AddFrameDescriptor(
joints[JointType.ElbowLeft].Position.X, joints[JointType.ElbowLeft].Position.Y, joints[JointType.ElbowLeft].Position.Z,
joints[JointType.SpineMid].Position.X, joints[JointType.SpineMid].Position.Y, joints[JointType.SpineMid].Position.Z,
spineBaseShoulderRHO
);
gesture.L.W.AddFrameDescriptor(
joints[JointType.WristLeft].Position.X, joints[JointType.WristLeft].Position.Y, joints[JointType.WristLeft].Position.Z,
joints[JointType.SpineMid].Position.X, joints[JointType.SpineMid].Position.Y, joints[JointType.SpineMid].Position.Z,
spineBaseShoulderRHO
);
gesture.L.H.AddFrameDescriptor(
joints[JointType.HandTipLeft].Position.X, joints[JointType.HandTipLeft].Position.Y, joints[JointType.HandTipLeft].Position.Z,
joints[JointType.SpineMid].Position.X, joints[JointType.SpineMid].Position.Y, joints[JointType.SpineMid].Position.Z,
spineBaseShoulderRHO
);
gesture.R.E.AddFrameDescriptor(
joints[JointType.ElbowRight].Position.X, joints[JointType.ElbowRight].Position.Y, joints[JointType.ElbowRight].Position.Z,
joints[JointType.SpineMid].Position.X, joints[JointType.SpineMid].Position.Y, joints[JointType.SpineMid].Position.Z,
spineBaseShoulderRHO
);
gesture.R.W.AddFrameDescriptor(
joints[JointType.WristRight].Position.X, joints[JointType.WristRight].Position.Y, joints[JointType.WristRight].Position.Z,
joints[JointType.SpineMid].Position.X, joints[JointType.SpineMid].Position.Y, joints[JointType.SpineMid].Position.Z,
spineBaseShoulderRHO
);
gesture.R.H.AddFrameDescriptor(
joints[JointType.HandTipRight].Position.X, joints[JointType.HandTipRight].Position.Y, joints[JointType.HandTipRight].Position.Z,
joints[JointType.SpineMid].Position.X, joints[JointType.SpineMid].Position.Y, joints[JointType.SpineMid].Position.Z,
spineBaseShoulderRHO
);
#endregion
}
}
}
}
else if (trackingState == TrackingState.Inferred)
{
drawBrush = this.inferredJointBrush;
}
if (drawBrush != null)
{
drawingContext.DrawEllipse(drawBrush, null, jointPoints[jointType], JointThickness, JointThickness);
}
}
}
}