Corrected some issues with how skeletons were displayed.

This commit is contained in:
marek
2016-02-02 15:37:40 +01:00
parent 128645d299
commit 6dfccc42c0
7 changed files with 83 additions and 49 deletions
+1
View File
@@ -34,6 +34,7 @@ namespace KinectServer
public BindingList<MarkerPose> lMarkerPoses = new BindingList<MarkerPose>();
public bool bStreamOnlyBodies = false;
public bool bShowSkeletons = true;
public int nNumICPIterations = 10;
public int nNumRefineIters = 2;
+39 -34
View File
@@ -259,7 +259,7 @@ namespace KinectServer
if ((DateTime.Now - tFPSUpdateTimer).Seconds >= 1)
{
double FPS = nTickCounter / (DateTime.Now - tFPSUpdateTimer).TotalSeconds;
this.Title = "FPS: " + string.Format("{0:F}", FPS);
//this.Title = "FPS: " + string.Format("{0:F}", FPS);
tFPSUpdateTimer = DateTime.Now;
nTickCounter = 0;
@@ -292,42 +292,43 @@ namespace KinectServer
lock (vertices)
{
lock (settings)
{
PointCount = vertices.Count / 3;
//bounding box
LineCount = 12;
//markers
LineCount += settings.lMarkerPoses.Count * 3;
//cameras
LineCount += cameraPoses.Count * 3;
bool bShowSkeletons = settings.bShowSkeletons;
PointCount = vertices.Count / 3;
//bounding box
LineCount = 12;
//markers
LineCount += settings.lMarkerPoses.Count * 3;
//cameras
LineCount += cameraPoses.Count * 3;
if (bShowSkeletons)
LineCount += 24 * bodies.Count;
VBO = new VertexC4ubV3f[PointCount + 2 * LineCount];
VBO = new VertexC4ubV3f[PointCount + 2 * LineCount];
for (int i = 0; i < PointCount; i++)
{
VBO[i].R = (byte)colors[i * 3];
VBO[i].G = (byte)colors[i * 3 + 1];
VBO[i].B = (byte)colors[i * 3 + 2];
VBO[i].A = 255;
VBO[i].Position.X = vertices[i * 3];
VBO[i].Position.Y = vertices[i * 3 + 1];
VBO[i].Position.Z = vertices[i * 3 + 2];
}
int iCurLineCount = 0;
iCurLineCount += AddBoundingBox(PointCount + 2 * iCurLineCount);
for (int i = 0; i < settings.lMarkerPoses.Count; i++)
{
iCurLineCount += AddMarker(PointCount + 2 * iCurLineCount, settings.lMarkerPoses[i].pose);
}
for (int i = 0; i < cameraPoses.Count; i++)
{
iCurLineCount += AddCamera(PointCount + 2 * iCurLineCount, cameraPoses[i]);
}
iCurLineCount += AddBodies(PointCount + 2 * iCurLineCount);
for (int i = 0; i < PointCount; i++)
{
VBO[i].R = (byte)colors[i * 3];
VBO[i].G = (byte)colors[i * 3 + 1];
VBO[i].B = (byte)colors[i * 3 + 2];
VBO[i].A = 255;
VBO[i].Position.X = vertices[i * 3];
VBO[i].Position.Y = vertices[i * 3 + 1];
VBO[i].Position.Z = vertices[i * 3 + 2];
}
int iCurLineCount = 0;
iCurLineCount += AddBoundingBox(PointCount + 2 * iCurLineCount);
for (int i = 0; i < settings.lMarkerPoses.Count; i++)
{
iCurLineCount += AddMarker(PointCount + 2 * iCurLineCount, settings.lMarkerPoses[i].pose);
}
for (int i = 0; i < cameraPoses.Count; i++)
{
iCurLineCount += AddCamera(PointCount + 2 * iCurLineCount, cameraPoses[i]);
}
if (bShowSkeletons)
iCurLineCount += AddBodies(PointCount + 2 * iCurLineCount);
}
}
@@ -574,6 +575,9 @@ namespace KinectServer
for (int bodyIdx = 0; bodyIdx < bodies.Count; bodyIdx++)
{
if (bodies[bodyIdx].bTracked == false)
continue;
//Torso
n += AddBone(bodyIdx, JointType.JointType_Head, JointType.JointType_Neck, startIdx + n);
n += AddBone(bodyIdx, JointType.JointType_Neck, JointType.JointType_SpineShoulder, startIdx + n);
@@ -607,7 +611,8 @@ namespace KinectServer
n += AddBone(bodyIdx, JointType.JointType_HipLeft, JointType.JointType_KneeLeft, startIdx + n);
n += AddBone(bodyIdx, JointType.JointType_KneeLeft, JointType.JointType_AnkleLeft, startIdx + n);
n += AddBone(bodyIdx, JointType.JointType_AnkleLeft, JointType.JointType_FootLeft, startIdx + n);
}
}
return nLinesToAdd;
}
+15 -1
View File
@@ -77,6 +77,7 @@
this.rAsciiPly = new System.Windows.Forms.RadioButton();
this.txtRefinIters = new System.Windows.Forms.TextBox();
this.lbOuterIters = new System.Windows.Forms.Label();
this.chSkeletons = new System.Windows.Forms.CheckBox();
this.grClient.SuspendLayout();
this.grBody.SuspendLayout();
this.grMarkers.SuspendLayout();
@@ -137,6 +138,7 @@
//
// grBody
//
this.grBody.Controls.Add(this.chSkeletons);
this.grBody.Controls.Add(this.label1);
this.grBody.Controls.Add(this.chBodyData);
this.grBody.Location = new System.Drawing.Point(9, 211);
@@ -149,7 +151,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(11, 43);
this.label1.Location = new System.Drawing.Point(8, 61);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(187, 13);
this.label1.TabIndex = 20;
@@ -570,6 +572,17 @@
this.lbOuterIters.TabIndex = 26;
this.lbOuterIters.Text = "Num of refinement iters:";
//
// chSkeletons
//
this.chSkeletons.AutoSize = true;
this.chSkeletons.Location = new System.Drawing.Point(11, 41);
this.chSkeletons.Name = "chSkeletons";
this.chSkeletons.Size = new System.Drawing.Size(154, 17);
this.chSkeletons.TabIndex = 21;
this.chSkeletons.Text = "show skeletons in live view";
this.chSkeletons.UseVisualStyleBackColor = true;
this.chSkeletons.CheckedChanged += new System.EventHandler(this.chSkeletons_CheckedChanged);
//
// SettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -648,6 +661,7 @@
private System.Windows.Forms.RadioButton rBinaryPly;
private System.Windows.Forms.Label lbFormat;
private System.Windows.Forms.RadioButton rAsciiPly;
private System.Windows.Forms.CheckBox chSkeletons;
}
}
+7 -1
View File
@@ -51,7 +51,8 @@ namespace KinectServer
lisMarkers.DataSource = oSettings.lMarkerPoses;
chBodyData.Checked = oSettings.bStreamOnlyBodies;
chBodyData.Checked = oSettings.bStreamOnlyBodies;
chSkeletons.Checked = oSettings.bShowSkeletons;
chMerge.Checked = oSettings.bMergeScansForSave;
txtICPIters.Text = oSettings.nNumICPIterations.ToString();
@@ -310,5 +311,10 @@ namespace KinectServer
oSettings.bSaveAsBinaryPLY = true;
}
}
private void chSkeletons_CheckedChanged(object sender, EventArgs e)
{
oSettings.bShowSkeletons = chSkeletons.Checked;
}
}
}