Added zstd frame compression option (about 25% less frame size for compression level = 2).

This commit is contained in:
JacekNaruniec
2017-01-13 21:05:01 +01:00
parent 25ef21692f
commit e068058868
13 changed files with 1004 additions and 135 deletions
+4
View File
@@ -35,6 +35,7 @@ namespace KinectServer
public bool bStreamOnlyBodies = false;
public bool bShowSkeletons = true;
public int iCompressionLevel = 2; // 0 for no compression, 2 is recommended
public int nNumICPIterations = 10;
public int nNumRefineIters = 2;
@@ -96,6 +97,9 @@ namespace KinectServer
else
lData.Add(0);
bTemp = BitConverter.GetBytes(iCompressionLevel);
lData.AddRange(bTemp);
return lData;
}
}
+10 -7
View File
@@ -42,7 +42,7 @@ namespace KinectServer
public List<byte> lFrameRGB = new List<byte>();
public List<Single> lFrameVerts = new List<Single>();
public List<Body> lBodies = new List<Body>();
public List<Body> lBodies = new List<Body>();
public event SocketChangedHandler eChanged;
@@ -165,19 +165,16 @@ namespace KinectServer
return;
}
oSocket.Receive(buffer, 4, SocketFlags.None);
//string result = System.Text.Encoding.UTF8.GetString(buffer);
//n_to_read = Int32.Parse(result);
oSocket.Receive(buffer, 8, SocketFlags.None);
nToRead = BitConverter.ToInt32(buffer, 0);
int iCompressed = BitConverter.ToInt32(buffer, 4);
if (nToRead == -1)
{
bNoMoreStoredFrames = true;
return;
}
buffer = new byte[nToRead];
int nAlreadyRead = 0;
@@ -192,6 +189,12 @@ namespace KinectServer
nAlreadyRead += oSocket.Receive(buffer, nAlreadyRead, nToRead - nAlreadyRead, SocketFlags.None);
}
if (iCompressed == 1)
buffer = ZSTDDecompressor.Decompress(buffer);
//Receive depth and color data
int startIdx = 0;
+6 -1
View File
@@ -32,7 +32,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL" />
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\OpenTK.dll</HintPath>
</Reference>
<Reference Include="OpenTK.Compatibility, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL" />
<Reference Include="OpenTK.GLControl, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL" />
<Reference Include="System" />
@@ -68,8 +71,10 @@
<Compile Include="TransferServer.cs" />
<Compile Include="TransferSocket.cs" />
<Compile Include="Utils.cs" />
<Compile Include="ZSTDDecompressor.cs" />
<EmbeddedResource Include="MainWindowForm.resx">
<DependentUpon>MainWindowForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
+200 -118
View File
@@ -34,7 +34,7 @@
this.txtICPIters = new System.Windows.Forms.TextBox();
this.grClient = new System.Windows.Forms.GroupBox();
this.grBody = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.chSkeletons = new System.Windows.Forms.CheckBox();
this.chBodyData = new System.Windows.Forms.CheckBox();
this.grMarkers = new System.Windows.Forms.GroupBox();
this.lbX2 = new System.Windows.Forms.Label();
@@ -77,7 +77,8 @@
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.label2 = new System.Windows.Forms.Label();
this.cbCompressionLevel = new System.Windows.Forms.ComboBox();
this.grClient.SuspendLayout();
this.grBody.SuspendLayout();
this.grMarkers.SuspendLayout();
@@ -89,18 +90,20 @@
// lbMerge
//
this.lbMerge.AutoSize = true;
this.lbMerge.Location = new System.Drawing.Point(6, 49);
this.lbMerge.Location = new System.Drawing.Point(7, 69);
this.lbMerge.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbMerge.Name = "lbMerge";
this.lbMerge.Size = new System.Drawing.Size(69, 13);
this.lbMerge.Size = new System.Drawing.Size(99, 20);
this.lbMerge.TabIndex = 22;
this.lbMerge.Text = "Scan saving:";
//
// chMerge
//
this.chMerge.AutoSize = true;
this.chMerge.Location = new System.Drawing.Point(98, 48);
this.chMerge.Location = new System.Drawing.Point(156, 70);
this.chMerge.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.chMerge.Name = "chMerge";
this.chMerge.Size = new System.Drawing.Size(86, 17);
this.chMerge.Size = new System.Drawing.Size(126, 24);
this.chMerge.TabIndex = 23;
this.chMerge.Text = "merge scans";
this.chMerge.UseVisualStyleBackColor = true;
@@ -109,17 +112,19 @@
// lbICPIters
//
this.lbICPIters.AutoSize = true;
this.lbICPIters.Location = new System.Drawing.Point(6, 26);
this.lbICPIters.Location = new System.Drawing.Point(7, 34);
this.lbICPIters.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbICPIters.Name = "lbICPIters";
this.lbICPIters.Size = new System.Drawing.Size(86, 13);
this.lbICPIters.Size = new System.Drawing.Size(128, 20);
this.lbICPIters.TabIndex = 24;
this.lbICPIters.Text = "Num of ICP iters:";
//
// txtICPIters
//
this.txtICPIters.Location = new System.Drawing.Point(98, 23);
this.txtICPIters.Location = new System.Drawing.Point(156, 31);
this.txtICPIters.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtICPIters.Name = "txtICPIters";
this.txtICPIters.Size = new System.Drawing.Size(38, 20);
this.txtICPIters.Size = new System.Drawing.Size(55, 26);
this.txtICPIters.TabIndex = 25;
this.txtICPIters.TextChanged += new System.EventHandler(this.txtICPIters_TextChanged);
//
@@ -129,9 +134,11 @@
this.grClient.Controls.Add(this.grMarkers);
this.grClient.Controls.Add(this.grBounding);
this.grClient.Controls.Add(this.grFiltering);
this.grClient.Location = new System.Drawing.Point(12, 12);
this.grClient.Location = new System.Drawing.Point(18, 18);
this.grClient.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grClient.Name = "grClient";
this.grClient.Size = new System.Drawing.Size(632, 327);
this.grClient.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grClient.Size = new System.Drawing.Size(948, 447);
this.grClient.TabIndex = 43;
this.grClient.TabStop = false;
this.grClient.Text = "KinectClient settings";
@@ -139,30 +146,35 @@
// 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);
this.grBody.Location = new System.Drawing.Point(14, 325);
this.grBody.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grBody.Name = "grBody";
this.grBody.Size = new System.Drawing.Size(249, 110);
this.grBody.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grBody.Size = new System.Drawing.Size(374, 101);
this.grBody.TabIndex = 47;
this.grBody.TabStop = false;
this.grBody.Text = "Body data";
//
// label1
// chSkeletons
//
this.label1.AutoSize = true;
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;
this.label1.Text = "More features will be added here soon";
this.chSkeletons.AutoSize = true;
this.chSkeletons.Location = new System.Drawing.Point(16, 63);
this.chSkeletons.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.chSkeletons.Name = "chSkeletons";
this.chSkeletons.Size = new System.Drawing.Size(220, 24);
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);
//
// chBodyData
//
this.chBodyData.AutoSize = true;
this.chBodyData.Location = new System.Drawing.Point(11, 19);
this.chBodyData.Location = new System.Drawing.Point(16, 29);
this.chBodyData.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.chBodyData.Name = "chBodyData";
this.chBodyData.Size = new System.Drawing.Size(113, 17);
this.chBodyData.Size = new System.Drawing.Size(167, 24);
this.chBodyData.TabIndex = 19;
this.chBodyData.Text = "stream only bodies";
this.chBodyData.UseVisualStyleBackColor = true;
@@ -186,9 +198,11 @@
this.grMarkers.Controls.Add(this.txtTranslationX);
this.grMarkers.Controls.Add(this.lisMarkers);
this.grMarkers.Controls.Add(this.txtTranslationY);
this.grMarkers.Location = new System.Drawing.Point(271, 19);
this.grMarkers.Location = new System.Drawing.Point(406, 29);
this.grMarkers.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grMarkers.Name = "grMarkers";
this.grMarkers.Size = new System.Drawing.Size(353, 185);
this.grMarkers.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grMarkers.Size = new System.Drawing.Size(530, 285);
this.grMarkers.TabIndex = 45;
this.grMarkers.TabStop = false;
this.grMarkers.Text = "Calibration markers";
@@ -196,17 +210,19 @@
// lbX2
//
this.lbX2.AutoSize = true;
this.lbX2.Location = new System.Drawing.Point(230, 19);
this.lbX2.Location = new System.Drawing.Point(345, 29);
this.lbX2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbX2.Name = "lbX2";
this.lbX2.Size = new System.Drawing.Size(14, 13);
this.lbX2.Size = new System.Drawing.Size(20, 20);
this.lbX2.TabIndex = 49;
this.lbX2.Text = "X";
//
// btRemove
//
this.btRemove.Location = new System.Drawing.Point(233, 127);
this.btRemove.Location = new System.Drawing.Point(350, 195);
this.btRemove.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btRemove.Name = "btRemove";
this.btRemove.Size = new System.Drawing.Size(92, 23);
this.btRemove.Size = new System.Drawing.Size(138, 35);
this.btRemove.TabIndex = 59;
this.btRemove.Text = "Remove marker";
this.btRemove.UseVisualStyleBackColor = true;
@@ -214,68 +230,76 @@
//
// txtOrientationZ
//
this.txtOrientationZ.Location = new System.Drawing.Point(305, 38);
this.txtOrientationZ.Location = new System.Drawing.Point(458, 58);
this.txtOrientationZ.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtOrientationZ.Name = "txtOrientationZ";
this.txtOrientationZ.Size = new System.Drawing.Size(38, 20);
this.txtOrientationZ.Size = new System.Drawing.Size(55, 26);
this.txtOrientationZ.TabIndex = 48;
this.txtOrientationZ.TextChanged += new System.EventHandler(this.txtOrientationZ_TextChanged);
//
// txtId
//
this.txtId.Location = new System.Drawing.Point(217, 93);
this.txtId.Location = new System.Drawing.Point(326, 143);
this.txtId.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtId.Name = "txtId";
this.txtId.Size = new System.Drawing.Size(38, 20);
this.txtId.Size = new System.Drawing.Size(55, 26);
this.txtId.TabIndex = 58;
this.txtId.TextChanged += new System.EventHandler(this.txtId_TextChanged);
//
// lbY2
//
this.lbY2.AutoSize = true;
this.lbY2.Location = new System.Drawing.Point(274, 19);
this.lbY2.Location = new System.Drawing.Point(411, 29);
this.lbY2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbY2.Name = "lbY2";
this.lbY2.Size = new System.Drawing.Size(14, 13);
this.lbY2.Size = new System.Drawing.Size(20, 20);
this.lbY2.TabIndex = 50;
this.lbY2.Text = "Y";
//
// txtOrientationY
//
this.txtOrientationY.Location = new System.Drawing.Point(261, 38);
this.txtOrientationY.Location = new System.Drawing.Point(392, 58);
this.txtOrientationY.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtOrientationY.Name = "txtOrientationY";
this.txtOrientationY.Size = new System.Drawing.Size(38, 20);
this.txtOrientationY.Size = new System.Drawing.Size(55, 26);
this.txtOrientationY.TabIndex = 47;
this.txtOrientationY.TextChanged += new System.EventHandler(this.txtOrientationY_TextChanged);
//
// lbId
//
this.lbId.AutoSize = true;
this.lbId.Location = new System.Drawing.Point(132, 96);
this.lbId.Location = new System.Drawing.Point(198, 148);
this.lbId.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbId.Name = "lbId";
this.lbId.Size = new System.Drawing.Size(54, 13);
this.lbId.Size = new System.Drawing.Size(78, 20);
this.lbId.TabIndex = 57;
this.lbId.Text = "Marker id:";
//
// lbZ2
//
this.lbZ2.AutoSize = true;
this.lbZ2.Location = new System.Drawing.Point(317, 19);
this.lbZ2.Location = new System.Drawing.Point(476, 29);
this.lbZ2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbZ2.Name = "lbZ2";
this.lbZ2.Size = new System.Drawing.Size(14, 13);
this.lbZ2.Size = new System.Drawing.Size(19, 20);
this.lbZ2.TabIndex = 51;
this.lbZ2.Text = "Z";
//
// txtOrientationX
//
this.txtOrientationX.Location = new System.Drawing.Point(217, 38);
this.txtOrientationX.Location = new System.Drawing.Point(326, 58);
this.txtOrientationX.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtOrientationX.Name = "txtOrientationX";
this.txtOrientationX.Size = new System.Drawing.Size(38, 20);
this.txtOrientationX.Size = new System.Drawing.Size(55, 26);
this.txtOrientationX.TabIndex = 46;
this.txtOrientationX.TextChanged += new System.EventHandler(this.txtOrientationX_TextChanged);
//
// btAdd
//
this.btAdd.Location = new System.Drawing.Point(135, 127);
this.btAdd.Location = new System.Drawing.Point(202, 195);
this.btAdd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btAdd.Name = "btAdd";
this.btAdd.Size = new System.Drawing.Size(92, 23);
this.btAdd.Size = new System.Drawing.Size(138, 35);
this.btAdd.TabIndex = 56;
this.btAdd.Text = "Add marker";
this.btAdd.UseVisualStyleBackColor = true;
@@ -284,51 +308,58 @@
// lbTranslation
//
this.lbTranslation.AutoSize = true;
this.lbTranslation.Location = new System.Drawing.Point(132, 68);
this.lbTranslation.Location = new System.Drawing.Point(198, 105);
this.lbTranslation.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbTranslation.Name = "lbTranslation";
this.lbTranslation.Size = new System.Drawing.Size(62, 13);
this.lbTranslation.Size = new System.Drawing.Size(91, 20);
this.lbTranslation.TabIndex = 52;
this.lbTranslation.Text = "Translation:";
//
// lbOrientation
//
this.lbOrientation.AutoSize = true;
this.lbOrientation.Location = new System.Drawing.Point(132, 41);
this.lbOrientation.Location = new System.Drawing.Point(198, 63);
this.lbOrientation.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbOrientation.Name = "lbOrientation";
this.lbOrientation.Size = new System.Drawing.Size(61, 13);
this.lbOrientation.Size = new System.Drawing.Size(91, 20);
this.lbOrientation.TabIndex = 45;
this.lbOrientation.Text = "Orientation:";
//
// txtTranslationZ
//
this.txtTranslationZ.Location = new System.Drawing.Point(305, 65);
this.txtTranslationZ.Location = new System.Drawing.Point(458, 100);
this.txtTranslationZ.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtTranslationZ.Name = "txtTranslationZ";
this.txtTranslationZ.Size = new System.Drawing.Size(38, 20);
this.txtTranslationZ.Size = new System.Drawing.Size(55, 26);
this.txtTranslationZ.TabIndex = 55;
this.txtTranslationZ.TextChanged += new System.EventHandler(this.txtTranslationZ_TextChanged);
//
// txtTranslationX
//
this.txtTranslationX.Location = new System.Drawing.Point(217, 65);
this.txtTranslationX.Location = new System.Drawing.Point(326, 100);
this.txtTranslationX.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtTranslationX.Name = "txtTranslationX";
this.txtTranslationX.Size = new System.Drawing.Size(38, 20);
this.txtTranslationX.Size = new System.Drawing.Size(55, 26);
this.txtTranslationX.TabIndex = 53;
this.txtTranslationX.TextChanged += new System.EventHandler(this.txtTranslationX_TextChanged);
//
// lisMarkers
//
this.lisMarkers.FormattingEnabled = true;
this.lisMarkers.Location = new System.Drawing.Point(6, 41);
this.lisMarkers.ItemHeight = 20;
this.lisMarkers.Location = new System.Drawing.Point(9, 63);
this.lisMarkers.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.lisMarkers.Name = "lisMarkers";
this.lisMarkers.Size = new System.Drawing.Size(120, 108);
this.lisMarkers.Size = new System.Drawing.Size(178, 164);
this.lisMarkers.TabIndex = 43;
this.lisMarkers.SelectedIndexChanged += new System.EventHandler(this.lisMarkers_SelectedIndexChanged);
//
// txtTranslationY
//
this.txtTranslationY.Location = new System.Drawing.Point(261, 65);
this.txtTranslationY.Location = new System.Drawing.Point(392, 100);
this.txtTranslationY.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtTranslationY.Name = "txtTranslationY";
this.txtTranslationY.Size = new System.Drawing.Size(38, 20);
this.txtTranslationY.Size = new System.Drawing.Size(55, 26);
this.txtTranslationY.TabIndex = 54;
this.txtTranslationY.TextChanged += new System.EventHandler(this.txtTranslationY_TextChanged);
//
@@ -345,9 +376,11 @@
this.grBounding.Controls.Add(this.lbZ);
this.grBounding.Controls.Add(this.lbY);
this.grBounding.Controls.Add(this.lbX);
this.grBounding.Location = new System.Drawing.Point(9, 19);
this.grBounding.Location = new System.Drawing.Point(14, 29);
this.grBounding.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grBounding.Name = "grBounding";
this.grBounding.Size = new System.Drawing.Size(249, 91);
this.grBounding.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grBounding.Size = new System.Drawing.Size(374, 140);
this.grBounding.TabIndex = 46;
this.grBounding.TabStop = false;
this.grBounding.Text = "Bounding box";
@@ -355,93 +388,104 @@
// lbMin
//
this.lbMin.AutoSize = true;
this.lbMin.Location = new System.Drawing.Point(8, 38);
this.lbMin.Location = new System.Drawing.Point(12, 58);
this.lbMin.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbMin.Name = "lbMin";
this.lbMin.Size = new System.Drawing.Size(65, 13);
this.lbMin.Size = new System.Drawing.Size(95, 20);
this.lbMin.TabIndex = 13;
this.lbMin.Text = "Min bounds:";
//
// txtMaxZ
//
this.txtMaxZ.Location = new System.Drawing.Point(181, 62);
this.txtMaxZ.Location = new System.Drawing.Point(272, 95);
this.txtMaxZ.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMaxZ.Name = "txtMaxZ";
this.txtMaxZ.Size = new System.Drawing.Size(38, 20);
this.txtMaxZ.Size = new System.Drawing.Size(55, 26);
this.txtMaxZ.TabIndex = 23;
this.txtMaxZ.TextChanged += new System.EventHandler(this.txtMaxZ_TextChanged);
//
// txtMaxY
//
this.txtMaxY.Location = new System.Drawing.Point(137, 62);
this.txtMaxY.Location = new System.Drawing.Point(206, 95);
this.txtMaxY.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMaxY.Name = "txtMaxY";
this.txtMaxY.Size = new System.Drawing.Size(38, 20);
this.txtMaxY.Size = new System.Drawing.Size(55, 26);
this.txtMaxY.TabIndex = 22;
this.txtMaxY.TextChanged += new System.EventHandler(this.txtMaxY_TextChanged);
//
// txtMinX
//
this.txtMinX.Location = new System.Drawing.Point(93, 35);
this.txtMinX.Location = new System.Drawing.Point(140, 54);
this.txtMinX.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMinX.Name = "txtMinX";
this.txtMinX.Size = new System.Drawing.Size(38, 20);
this.txtMinX.Size = new System.Drawing.Size(55, 26);
this.txtMinX.TabIndex = 14;
this.txtMinX.TextChanged += new System.EventHandler(this.txtMinX_TextChanged);
//
// txtMaxX
//
this.txtMaxX.Location = new System.Drawing.Point(93, 62);
this.txtMaxX.Location = new System.Drawing.Point(140, 95);
this.txtMaxX.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMaxX.Name = "txtMaxX";
this.txtMaxX.Size = new System.Drawing.Size(38, 20);
this.txtMaxX.Size = new System.Drawing.Size(55, 26);
this.txtMaxX.TabIndex = 21;
this.txtMaxX.TextChanged += new System.EventHandler(this.txtMaxX_TextChanged);
//
// txtMinY
//
this.txtMinY.Location = new System.Drawing.Point(137, 35);
this.txtMinY.Location = new System.Drawing.Point(206, 54);
this.txtMinY.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMinY.Name = "txtMinY";
this.txtMinY.Size = new System.Drawing.Size(38, 20);
this.txtMinY.Size = new System.Drawing.Size(55, 26);
this.txtMinY.TabIndex = 15;
this.txtMinY.TextChanged += new System.EventHandler(this.txtMinY_TextChanged);
//
// lbMax
//
this.lbMax.AutoSize = true;
this.lbMax.Location = new System.Drawing.Point(8, 65);
this.lbMax.Location = new System.Drawing.Point(12, 100);
this.lbMax.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbMax.Name = "lbMax";
this.lbMax.Size = new System.Drawing.Size(68, 13);
this.lbMax.Size = new System.Drawing.Size(99, 20);
this.lbMax.TabIndex = 20;
this.lbMax.Text = "Max bounds:";
//
// txtMinZ
//
this.txtMinZ.Location = new System.Drawing.Point(181, 35);
this.txtMinZ.Location = new System.Drawing.Point(272, 54);
this.txtMinZ.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMinZ.Name = "txtMinZ";
this.txtMinZ.Size = new System.Drawing.Size(38, 20);
this.txtMinZ.Size = new System.Drawing.Size(55, 26);
this.txtMinZ.TabIndex = 16;
this.txtMinZ.TextChanged += new System.EventHandler(this.txtMinZ_TextChanged);
//
// lbZ
//
this.lbZ.AutoSize = true;
this.lbZ.Location = new System.Drawing.Point(193, 16);
this.lbZ.Location = new System.Drawing.Point(290, 25);
this.lbZ.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbZ.Name = "lbZ";
this.lbZ.Size = new System.Drawing.Size(14, 13);
this.lbZ.Size = new System.Drawing.Size(19, 20);
this.lbZ.TabIndex = 19;
this.lbZ.Text = "Z";
//
// lbY
//
this.lbY.AutoSize = true;
this.lbY.Location = new System.Drawing.Point(150, 16);
this.lbY.Location = new System.Drawing.Point(225, 25);
this.lbY.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbY.Name = "lbY";
this.lbY.Size = new System.Drawing.Size(14, 13);
this.lbY.Size = new System.Drawing.Size(20, 20);
this.lbY.TabIndex = 18;
this.lbY.Text = "Y";
//
// lbX
//
this.lbX.AutoSize = true;
this.lbX.Location = new System.Drawing.Point(106, 16);
this.lbX.Location = new System.Drawing.Point(159, 25);
this.lbX.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbX.Name = "lbX";
this.lbX.Size = new System.Drawing.Size(14, 13);
this.lbX.Size = new System.Drawing.Size(20, 20);
this.lbX.TabIndex = 17;
this.lbX.Text = "X";
//
@@ -452,27 +496,31 @@
this.grFiltering.Controls.Add(this.lbFilterNeighbors);
this.grFiltering.Controls.Add(this.lbFilterDistance);
this.grFiltering.Controls.Add(this.txtFilterDistance);
this.grFiltering.Location = new System.Drawing.Point(9, 116);
this.grFiltering.Location = new System.Drawing.Point(14, 178);
this.grFiltering.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grFiltering.Name = "grFiltering";
this.grFiltering.Size = new System.Drawing.Size(249, 88);
this.grFiltering.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grFiltering.Size = new System.Drawing.Size(374, 135);
this.grFiltering.TabIndex = 45;
this.grFiltering.TabStop = false;
this.grFiltering.Text = "Filtering";
//
// txtFilterNeighbors
//
this.txtFilterNeighbors.Location = new System.Drawing.Point(93, 39);
this.txtFilterNeighbors.Location = new System.Drawing.Point(140, 60);
this.txtFilterNeighbors.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtFilterNeighbors.Name = "txtFilterNeighbors";
this.txtFilterNeighbors.Size = new System.Drawing.Size(38, 20);
this.txtFilterNeighbors.Size = new System.Drawing.Size(55, 26);
this.txtFilterNeighbors.TabIndex = 20;
this.txtFilterNeighbors.TextChanged += new System.EventHandler(this.txtFilterNeighbors_TextChanged);
//
// chFilter
//
this.chFilter.AutoSize = true;
this.chFilter.Location = new System.Drawing.Point(93, 16);
this.chFilter.Location = new System.Drawing.Point(140, 25);
this.chFilter.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.chFilter.Name = "chFilter";
this.chFilter.Size = new System.Drawing.Size(100, 17);
this.chFilter.Size = new System.Drawing.Size(147, 24);
this.chFilter.TabIndex = 18;
this.chFilter.Text = "filtering enabled";
this.chFilter.UseVisualStyleBackColor = true;
@@ -481,31 +529,36 @@
// lbFilterNeighbors
//
this.lbFilterNeighbors.AutoSize = true;
this.lbFilterNeighbors.Location = new System.Drawing.Point(8, 42);
this.lbFilterNeighbors.Location = new System.Drawing.Point(12, 65);
this.lbFilterNeighbors.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbFilterNeighbors.Name = "lbFilterNeighbors";
this.lbFilterNeighbors.Size = new System.Drawing.Size(67, 13);
this.lbFilterNeighbors.Size = new System.Drawing.Size(98, 20);
this.lbFilterNeighbors.TabIndex = 19;
this.lbFilterNeighbors.Text = "N neighbors:";
//
// lbFilterDistance
//
this.lbFilterDistance.AutoSize = true;
this.lbFilterDistance.Location = new System.Drawing.Point(8, 68);
this.lbFilterDistance.Location = new System.Drawing.Point(12, 105);
this.lbFilterDistance.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbFilterDistance.Name = "lbFilterDistance";
this.lbFilterDistance.Size = new System.Drawing.Size(73, 13);
this.lbFilterDistance.Size = new System.Drawing.Size(106, 20);
this.lbFilterDistance.TabIndex = 21;
this.lbFilterDistance.Text = "Max distance:";
//
// txtFilterDistance
//
this.txtFilterDistance.Location = new System.Drawing.Point(93, 65);
this.txtFilterDistance.Location = new System.Drawing.Point(140, 100);
this.txtFilterDistance.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtFilterDistance.Name = "txtFilterDistance";
this.txtFilterDistance.Size = new System.Drawing.Size(38, 20);
this.txtFilterDistance.Size = new System.Drawing.Size(55, 26);
this.txtFilterDistance.TabIndex = 22;
this.txtFilterDistance.TextChanged += new System.EventHandler(this.txtFilterDistance_TextChanged);
//
// grServer
//
this.grServer.Controls.Add(this.cbCompressionLevel);
this.grServer.Controls.Add(this.label2);
this.grServer.Controls.Add(this.rBinaryPly);
this.grServer.Controls.Add(this.lbFormat);
this.grServer.Controls.Add(this.rAsciiPly);
@@ -515,9 +568,11 @@
this.grServer.Controls.Add(this.txtICPIters);
this.grServer.Controls.Add(this.chMerge);
this.grServer.Controls.Add(this.lbICPIters);
this.grServer.Location = new System.Drawing.Point(12, 345);
this.grServer.Location = new System.Drawing.Point(18, 478);
this.grServer.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grServer.Name = "grServer";
this.grServer.Size = new System.Drawing.Size(632, 111);
this.grServer.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grServer.Size = new System.Drawing.Size(948, 175);
this.grServer.TabIndex = 44;
this.grServer.TabStop = false;
this.grServer.Text = "KinectServer settings";
@@ -525,9 +580,10 @@
// rBinaryPly
//
this.rBinaryPly.AutoSize = true;
this.rBinaryPly.Location = new System.Drawing.Point(179, 71);
this.rBinaryPly.Location = new System.Drawing.Point(277, 105);
this.rBinaryPly.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.rBinaryPly.Name = "rBinaryPly";
this.rBinaryPly.Size = new System.Drawing.Size(76, 17);
this.rBinaryPly.Size = new System.Drawing.Size(110, 24);
this.rBinaryPly.TabIndex = 30;
this.rBinaryPly.TabStop = true;
this.rBinaryPly.Text = "binary PLY";
@@ -537,18 +593,20 @@
// lbFormat
//
this.lbFormat.AutoSize = true;
this.lbFormat.Location = new System.Drawing.Point(6, 73);
this.lbFormat.Location = new System.Drawing.Point(7, 106);
this.lbFormat.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbFormat.Name = "lbFormat";
this.lbFormat.Size = new System.Drawing.Size(58, 13);
this.lbFormat.Size = new System.Drawing.Size(88, 20);
this.lbFormat.TabIndex = 29;
this.lbFormat.Text = "File format:";
//
// rAsciiPly
//
this.rAsciiPly.AutoSize = true;
this.rAsciiPly.Location = new System.Drawing.Point(98, 71);
this.rAsciiPly.Location = new System.Drawing.Point(156, 105);
this.rAsciiPly.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.rAsciiPly.Name = "rAsciiPly";
this.rAsciiPly.Size = new System.Drawing.Size(75, 17);
this.rAsciiPly.Size = new System.Drawing.Size(111, 24);
this.rAsciiPly.TabIndex = 28;
this.rAsciiPly.TabStop = true;
this.rAsciiPly.Text = "ASCII PLY";
@@ -557,40 +615,63 @@
//
// txtRefinIters
//
this.txtRefinIters.Location = new System.Drawing.Point(266, 23);
this.txtRefinIters.Location = new System.Drawing.Point(408, 31);
this.txtRefinIters.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtRefinIters.Name = "txtRefinIters";
this.txtRefinIters.Size = new System.Drawing.Size(38, 20);
this.txtRefinIters.Size = new System.Drawing.Size(55, 26);
this.txtRefinIters.TabIndex = 27;
this.txtRefinIters.TextChanged += new System.EventHandler(this.txtRefinIters_TextChanged);
//
// lbOuterIters
//
this.lbOuterIters.AutoSize = true;
this.lbOuterIters.Location = new System.Drawing.Point(142, 26);
this.lbOuterIters.Location = new System.Drawing.Point(222, 36);
this.lbOuterIters.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbOuterIters.Name = "lbOuterIters";
this.lbOuterIters.Size = new System.Drawing.Size(118, 13);
this.lbOuterIters.Size = new System.Drawing.Size(178, 20);
this.lbOuterIters.TabIndex = 26;
this.lbOuterIters.Text = "Num of refinement iters:";
//
// chSkeletons
// label2
//
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);
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(8, 139);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(141, 20);
this.label2.TabIndex = 31;
this.label2.Text = "Compression level:";
//
// cbCompressionLevel
//
this.cbCompressionLevel.FormattingEnabled = true;
this.cbCompressionLevel.Items.AddRange(new object[] {
"0 (no compression)",
"1",
"2 (recommended)",
"3",
"5",
"7",
"9",
"11",
"13",
"15",
"17",
"19"});
this.cbCompressionLevel.Location = new System.Drawing.Point(154, 136);
this.cbCompressionLevel.Name = "cbCompressionLevel";
this.cbCompressionLevel.Size = new System.Drawing.Size(169, 28);
this.cbCompressionLevel.TabIndex = 32;
this.cbCompressionLevel.SelectedIndexChanged += new System.EventHandler(this.cbCompressionLevel_SelectedIndexChanged);
//
// SettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(656, 468);
this.ClientSize = new System.Drawing.Size(984, 663);
this.Controls.Add(this.grServer);
this.Controls.Add(this.grClient);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false;
this.Name = "SettingsForm";
this.Text = "Settings";
@@ -657,11 +738,12 @@
private System.Windows.Forms.Label lbX;
private System.Windows.Forms.GroupBox grBody;
private System.Windows.Forms.CheckBox chBodyData;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.RadioButton rBinaryPly;
private System.Windows.Forms.Label lbFormat;
private System.Windows.Forms.RadioButton rAsciiPly;
private System.Windows.Forms.CheckBox chSkeletons;
private System.Windows.Forms.ComboBox cbCompressionLevel;
private System.Windows.Forms.Label label2;
}
}
+18
View File
@@ -54,6 +54,8 @@ namespace KinectServer
chBodyData.Checked = oSettings.bStreamOnlyBodies;
chSkeletons.Checked = oSettings.bShowSkeletons;
cbCompressionLevel.SelectedText = oSettings.iCompressionLevel.ToString();
chMerge.Checked = oSettings.bMergeScansForSave;
txtICPIters.Text = oSettings.nNumICPIterations.ToString();
txtRefinIters.Text = oSettings.nNumRefineIters.ToString();
@@ -316,5 +318,21 @@ namespace KinectServer
{
oSettings.bShowSkeletons = chSkeletons.Checked;
}
private void cbCompressionLevel_SelectedIndexChanged(object sender, EventArgs e)
{
int index = cbCompressionLevel.SelectedIndex;
if (index == 0)
oSettings.iCompressionLevel = 0;
else if (index == 2)
oSettings.iCompressionLevel = 2;
else
{
string value = cbCompressionLevel.SelectedItem.ToString();
bool tryParse = Int32.TryParse(value, out oSettings.iCompressionLevel);
if (!tryParse)
oSettings.iCompressionLevel = 0;
}
}
}
}
+41
View File
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using size_t = System.UIntPtr;
namespace KinectServer
{
static class ZSTDDecompressor
{
private const string dllName = "libzstd.dll";
[DllImport(dllName, CallingConvention = CallingConvention.Cdecl)]
public static extern ulong ZSTD_getDecompressedSize(IntPtr src, size_t srcSize);
[DllImport(dllName, CallingConvention = CallingConvention.Cdecl)]
public static extern size_t ZSTD_decompress(IntPtr dst, size_t dstSize,
IntPtr src, size_t srcSize);
public static byte[] Decompress(byte []array)
{
int size = array.Count();
IntPtr ptr = Marshal.AllocHGlobal(size);
Marshal.Copy(array, 0, ptr, size);
int outSize = (int)ZSTD_getDecompressedSize(ptr, (size_t)size);
IntPtr outPtr = Marshal.AllocHGlobal(outSize);
ZSTD_decompress(outPtr, (size_t)outSize, ptr, (size_t)size);
byte[] outArray = new byte[outSize];
Marshal.Copy(outPtr, outArray, 0, outSize);
Marshal.FreeHGlobal(ptr);
Marshal.FreeHGlobal(outPtr);
return outArray;
}
}
}