17 Commits

Author SHA1 Message Date
Marek 7d56c5239b Merge pull request #49 from ChristopherRemde/Azure_Kinect_Temp_Sync
Added Temporal Synchronisation
2021-03-06 11:46:30 +00:00
Christopher Remde 6fed026d41 Added documentation for Azure Kinect features 2020-12-14 17:57:40 +01:00
Christopher Remde 3192da1b10 Readme Update
Added docs for the "Temporal Sync" and "Exposure Control" Feature
2020-12-14 17:23:14 +01:00
Christopher Remde 6b983126f3 Merge branch 'AzureKinect' into Azure_Kinect_Temp_Sync 2020-10-20 17:55:08 +02:00
Christopher Remde 76bf5e9dba Added new UI for the Temporal Sync Feature, made the software more robust including:
-Settings window can only be opened once
    -When the client can't open a device, it tries multiple times
    -Recording bins are now saved with a unique ID per device, to allow multiple clients to record on the same PC
    -Synchronized & Unsynchronized devices can be both used in one server
    -Included a workaround for a bug in the Azure Kinect SDK regarding exposure (microsoft/Azure-Kinect-Sensor-SDK#1378)
2020-10-14 23:21:18 +02:00
Marek 13e634f76a Merge pull request #48 from ChristopherRemde/AzureKinect_Mapping_Fix
Changed Color Image Mapping to be more accurate
2020-08-04 07:30:56 +01:00
Christopher Remde df80603b6f Change snake_case to camelCase, removed unused code, change interpolation to INTER_LINEAR, removed .exe files 2020-07-29 19:09:48 +02:00
Christopher Remde 2b15ed0f5b Cleaned up 2020-07-08 14:15:49 +02:00
Christopher Remde 1544abd276 Finished Temporal Sync Feature 2020-07-08 13:55:48 +02:00
Christopher Remde 4a7e9904d5 Removed some comments and unused headers 2020-07-02 14:12:50 +02:00
Christopher Remde 00383d8867 Finalized depth_image_to_Color_Camera mapping, added dynamic resize of the Color Image via OpenCV for improved performance and improved performance on the StoreFrame function by avoiding "vector.push_back" 2020-07-02 13:50:24 +02:00
Christopher Remde da2c304db8 Added Temporal Sync functionality 2020-06-10 13:59:09 +02:00
Marek Kowalski 4a4f9ae0ad Synchronized mode gets slightly better framerate when multiple devices connected 2019-09-18 19:26:02 +01:00
Marek Kowalski 9c219fbc44 Fixed memory leak 2019-09-18 18:56:36 +01:00
Marek Kowalski 4dfb5765e6 Changed to next version of Kinect SDK 2019-09-18 18:56:19 +01:00
Marek Kowalski e2a03f9c8a Added support for multiple Azure Kinects on same machine 2019-08-16 18:03:41 +01:00
Marek Kowalski f49bcaf5d9 Working with Azure Kinect but without body and only single sensor per machine 2019-08-16 17:27:03 +01:00
27 changed files with 1876 additions and 793 deletions
+8 -8
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@@ -29,46 +29,46 @@
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{973EE923-B423-4BCD-AA08-B03DA40CB51F}</ProjectGuid> <ProjectGuid>{973EE923-B423-4BCD-AA08-B03DA40CB51F}</ProjectGuid>
<RootNamespace>ICP</RootNamespace> <RootNamespace>ICP</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
+20 -10
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@@ -19,13 +19,13 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\include\LiveScanClient\azureKinectCapture.h" />
<ClInclude Include="..\include\LiveScanClient\calibration.h" /> <ClInclude Include="..\include\LiveScanClient\calibration.h" />
<ClInclude Include="..\include\LiveScanClient\filter.h" /> <ClInclude Include="..\include\LiveScanClient\filter.h" />
<ClInclude Include="..\include\LiveScanClient\frameFileWriterReader.h" /> <ClInclude Include="..\include\LiveScanClient\frameFileWriterReader.h" />
<ClInclude Include="..\include\LiveScanClient\iCapture.h" /> <ClInclude Include="..\include\LiveScanClient\iCapture.h" />
<ClInclude Include="..\include\LiveScanClient\imageRenderer.h" /> <ClInclude Include="..\include\LiveScanClient\imageRenderer.h" />
<ClInclude Include="..\include\LiveScanClient\iMarker.h" /> <ClInclude Include="..\include\LiveScanClient\iMarker.h" />
<ClInclude Include="..\include\LiveScanClient\kinectCapture.h" />
<ClInclude Include="..\include\LiveScanClient\liveScanClient.h" /> <ClInclude Include="..\include\LiveScanClient\liveScanClient.h" />
<ClInclude Include="..\include\LiveScanClient\marker.h" /> <ClInclude Include="..\include\LiveScanClient\marker.h" />
<ClInclude Include="..\include\LiveScanClient\utils.h" /> <ClInclude Include="..\include\LiveScanClient\utils.h" />
@@ -35,13 +35,13 @@
<ClInclude Include="stdafx.h" /> <ClInclude Include="stdafx.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\src\LiveScanClient\azureKinectCapture.cpp" />
<ClCompile Include="..\src\LiveScanClient\calibration.cpp" /> <ClCompile Include="..\src\LiveScanClient\calibration.cpp" />
<ClCompile Include="..\src\LiveScanClient\filter.cpp" /> <ClCompile Include="..\src\LiveScanClient\filter.cpp" />
<ClCompile Include="..\src\LiveScanClient\frameFileWriterReader.cpp" /> <ClCompile Include="..\src\LiveScanClient\frameFileWriterReader.cpp" />
<ClCompile Include="..\src\LiveScanClient\iCapture.cpp" /> <ClCompile Include="..\src\LiveScanClient\iCapture.cpp" />
<ClCompile Include="..\src\LiveScanClient\imageRenderer.cpp" /> <ClCompile Include="..\src\LiveScanClient\imageRenderer.cpp" />
<ClCompile Include="..\src\LiveScanClient\iMarker.cpp" /> <ClCompile Include="..\src\LiveScanClient\iMarker.cpp" />
<ClCompile Include="..\src\LiveScanClient\kinectCapture.cpp" />
<ClCompile Include="..\src\LiveScanClient\liveScanClient.cpp" /> <ClCompile Include="..\src\LiveScanClient\liveScanClient.cpp" />
<ClCompile Include="..\src\LiveScanClient\marker.cpp" /> <ClCompile Include="..\src\LiveScanClient\marker.cpp" />
<ClCompile Include="..\src\LiveScanClient\utils.cpp" /> <ClCompile Include="..\src\LiveScanClient\utils.cpp" />
@@ -53,36 +53,39 @@
<ItemGroup> <ItemGroup>
<Image Include="app.ico" /> <Image Include="app.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{9B550BBA-EAFB-4D12-8B1C-8FDA39361F52}</ProjectGuid> <ProjectGuid>{9B550BBA-EAFB-4D12-8B1C-8FDA39361F52}</ProjectGuid>
<RootNamespace>KinectClient</RootNamespace> <RootNamespace>KinectClient</RootNamespace>
<ProjectName>LiveScanClient</ProjectName> <ProjectName>LiveScanClient</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
@@ -144,7 +147,7 @@
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(KINECTSDK20_DIR)\lib\x64;$(SolutionDir)lib</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(KINECTSDK20_DIR)\lib\x64;$(SolutionDir)lib</AdditionalLibraryDirectories>
<AdditionalDependencies>opencv_world320d.lib;kinect20.lib;libzstd.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>opencv_world320d.lib;libzstd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>NotSet</SubSystem> <SubSystem>NotSet</SubSystem>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
@@ -184,11 +187,18 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>opencv_world320.lib;kinect20.lib;libzstd.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>opencv_world320.lib;libzstd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(KINECTSDK20_DIR)\lib\x64;$(SolutionDir)lib</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(KINECTSDK20_DIR)\lib\x64;$(SolutionDir)lib</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\Microsoft.Azure.Kinect.Sensor.1.4.1\build\native\Microsoft.Azure.Kinect.Sensor.targets" Condition="Exists('..\packages\Microsoft.Azure.Kinect.Sensor.1.4.1\build\native\Microsoft.Azure.Kinect.Sensor.targets')" />
</ImportGroup> </ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Azure.Kinect.Sensor.1.4.1\build\native\Microsoft.Azure.Kinect.Sensor.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.Kinect.Sensor.1.4.1\build\native\Microsoft.Azure.Kinect.Sensor.targets'))" />
</Target>
</Project> </Project>
+9 -6
View File
@@ -42,9 +42,6 @@
<ClInclude Include="..\include\LiveScanClient\iMarker.h"> <ClInclude Include="..\include\LiveScanClient\iMarker.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\include\LiveScanClient\kinectCapture.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\LiveScanClient\liveScanClient.h"> <ClInclude Include="..\include\LiveScanClient\liveScanClient.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@@ -57,6 +54,9 @@
<ClInclude Include="..\include\LiveScanClient\frameFileWriterReader.h"> <ClInclude Include="..\include\LiveScanClient\frameFileWriterReader.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\include\LiveScanClient\azureKinectCapture.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\src\socketCS.cpp"> <ClCompile Include="..\src\socketCS.cpp">
@@ -77,9 +77,6 @@
<ClCompile Include="..\src\LiveScanClient\iMarker.cpp"> <ClCompile Include="..\src\LiveScanClient\iMarker.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\LiveScanClient\kinectCapture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\LiveScanClient\liveScanClient.cpp"> <ClCompile Include="..\src\LiveScanClient\liveScanClient.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@@ -92,6 +89,9 @@
<ClCompile Include="..\src\LiveScanClient\frameFileWriterReader.cpp"> <ClCompile Include="..\src\LiveScanClient\frameFileWriterReader.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\LiveScanClient\azureKinectCapture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Image Include="app.ico"> <Image Include="app.ico">
@@ -103,4 +103,7 @@
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
</ResourceCompile> </ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project> </Project>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Azure.Kinect.Sensor" version="1.4.1" targetFramework="native" />
</packages>
-2
View File
@@ -46,8 +46,6 @@ namespace LiveScanPlayer
lineParts = ReadLine().Split(' '); lineParts = ReadLine().Split(' ');
int frameTimestamp = Int32.Parse(lineParts[1]); int frameTimestamp = Int32.Parse(lineParts[1]);
Console.WriteLine((frameTimestamp / 1000).ToString());
short[] tempVertices = new short[3 * nPoints]; short[] tempVertices = new short[3 * nPoints];
byte[] tempColors = new byte[4 * nPoints]; byte[] tempColors = new byte[4 * nPoints];
+211
View File
@@ -22,6 +22,7 @@ using System.Threading;
using System.Net.Sockets; using System.Net.Sockets;
using System.Net; using System.Net;
using System.ComponentModel; using System.ComponentModel;
using System.Windows.Forms;
namespace KinectServer namespace KinectServer
{ {
@@ -31,8 +32,15 @@ namespace KinectServer
Socket oServerSocket; Socket oServerSocket;
bool bServerRunning = false; bool bServerRunning = false;
bool bWaitForSubToStart = false;
//This lock prevents the user from enabeling/disabling the Temp Sync State while the cameras are in transition to another state.
//When starting the server, all devices are already initialized, as the LiveScanClient can only connect with an initialized device
bool allDevicesInitialized = true;
KinectSettings oSettings; KinectSettings oSettings;
SettingsForm fSettingsForm;
MainWindowForm fMainWindowForm;
object oClientSocketLock = new object(); object oClientSocketLock = new object();
object oFrameRequestLock = new object(); object oFrameRequestLock = new object();
@@ -132,6 +140,21 @@ namespace KinectServer
this.oSettings = settings; this.oSettings = settings;
} }
public void SetSettingsForm(SettingsForm settings)
{
fSettingsForm = settings;
}
public void SetMainWindowForm(MainWindowForm main)
{
fMainWindowForm = main;
}
public SettingsForm GetSettingsForm()
{
return fSettingsForm;
}
private void SocketListChanged() private void SocketListChanged()
{ {
if (eSocketListChanged != null) if (eSocketListChanged != null)
@@ -225,6 +248,7 @@ namespace KinectServer
{ {
lock (oClientSocketLock) lock (oClientSocketLock)
{ {
for (int i = 0; i < lClientSockets.Count; i++) for (int i = 0; i < lClientSockets.Count; i++)
{ {
lClientSockets[i].SendCalibrationData(); lClientSockets[i].SendCalibrationData();
@@ -232,6 +256,170 @@ namespace KinectServer
} }
} }
/// <summary>
/// Request the device Sync state, so that we know which Device is Master and which are Subordinates before starting them
/// </summary>
public void RequestDeviceSyncState()
{
lock (oClientSocketLock)
{
for (int i = 0; i < lClientSockets.Count; i++)
{
lClientSockets[i].RequestTempSyncState();
}
}
}
/// <summary>
/// When a client has send its Device Sync State, we try to Set the Client Sync State
/// </summary>
public void SendTemporalSyncData()
{
lock (oClientSocketLock)
{
int masterCount = 0;
int subordinateCount = 0;
//First we check if we have recieved the Device Sync State of all Devices
//If not, we return and the next client who confirms their state starts this function again
for (int i = 0; i < lClientSockets.Count; i++)
{
if(lClientSockets[i].currentDeviceTempSyncState == KinectSocket.eTempSyncConfig.MASTER)
{
masterCount++;
}
if (lClientSockets[i].currentDeviceTempSyncState == KinectSocket.eTempSyncConfig.SUBORDINATE)
{
subordinateCount++;
}
if (lClientSockets[i].currentDeviceTempSyncState == KinectSocket.eTempSyncConfig.UNKNOWN)
{
return;
}
}
//On a second step we check if we have exactly one master and at least one subordinate
if(masterCount != 1 || subordinateCount < 1)
{
//If not, we show a error message and disable the temporal sync
fMainWindowForm?.SetStatusBarOnTimer("Temporal Sync cables not connected properly", 5000);
fSettingsForm?.ActivateTempSyncEnableButton();
return;
}
allDevicesInitialized = false;
byte syncOffSetCounter = 0;
for (int i = 0; i < lClientSockets.Count; i++)
{
if(lClientSockets[i].currentDeviceTempSyncState == KinectSocket.eTempSyncConfig.SUBORDINATE)
{
syncOffSetCounter++;
}
lClientSockets[i].SendTemporalSyncStatus(true, syncOffSetCounter);
}
bWaitForSubToStart = true;
}
}
/// <summary>
/// Sets all clients as standalone
/// </summary>
public void DisableTemporalSync()
{
allDevicesInitialized = false;
lock (oClientSocketLock)
{
for (int i = 0; i < lClientSockets.Count; i++)
{
lClientSockets[i].SendTemporalSyncStatus(false, 0);
}
}
}
public void ConfirmTemporalSyncDisabled()
{
if (bWaitForSubToStart)
return;
lock (oClientSocketLock)
{
for (int i = 0; i < lClientSockets.Count; i++)
{
if (lClientSockets[i].currentClientTempSyncState != KinectSocket.eTempSyncConfig.STANDALONE)
{
return;
}
}
}
allDevicesInitialized = true;
}
/// <summary>
/// Called when a sub client has started. This checks if all sub clients have already started. If yes, we initialize the master
/// </summary>
public void CheckForMasterStart()
{
if (!bWaitForSubToStart)
{
return;
}
bool allSubsStarted = true;
lock (oClientSocketLock)
{
for (int i = 0; i < lClientSockets.Count; i++)
{
if (!lClientSockets[i].bSubStarted && lClientSockets[i].currentClientTempSyncState == KinectSocket.eTempSyncConfig.SUBORDINATE)
{
allSubsStarted = false;
break;
}
}
bWaitForSubToStart = false;
if (allSubsStarted)
{
for (int i = 0; i < lClientSockets.Count; i++)
{
if(lClientSockets[i].currentDeviceTempSyncState == KinectSocket.eTempSyncConfig.MASTER)
{
lClientSockets[i].SendMasterInitialize();
return;
}
}
}
}
}
/// <summary>
/// Tells the server that it is now ok to start recieving user changes again
/// </summary>
public void MasterSuccessfullyRestarted()
{
allDevicesInitialized = true;
}
public bool GetAllDevicesInitialized()
{
return allDevicesInitialized;
}
public bool GetStoredFrame(List<List<byte>> lFramesRGB, List<List<Single>> lFramesVerts) public bool GetStoredFrame(List<List<byte>> lFramesRGB, List<List<Single>> lFramesVerts)
{ {
bool bNoMoreStoredFrames; bool bNoMoreStoredFrames;
@@ -303,6 +491,7 @@ namespace KinectServer
//Wait till frames received //Wait till frames received
bool allGathered = false; bool allGathered = false;
while (!allGathered) while (!allGathered)
{ {
allGathered = true; allGathered = true;
@@ -318,6 +507,7 @@ namespace KinectServer
} }
} }
} }
} }
//Store received frames //Store received frames
@@ -330,6 +520,7 @@ namespace KinectServer
lFramesBody.Add(new List<Body>(lClientSockets[i].lBodies)); lFramesBody.Add(new List<Body>(lClientSockets[i].lBodies));
} }
} }
} }
} }
@@ -360,6 +551,11 @@ namespace KinectServer
lClientSockets.Add(new KinectSocket(newClient)); lClientSockets.Add(new KinectSocket(newClient));
lClientSockets[lClientSockets.Count - 1].SendSettings(oSettings); lClientSockets[lClientSockets.Count - 1].SendSettings(oSettings);
lClientSockets[lClientSockets.Count - 1].eChanged += new SocketChangedHandler(SocketListChanged); lClientSockets[lClientSockets.Count - 1].eChanged += new SocketChangedHandler(SocketListChanged);
lClientSockets[lClientSockets.Count - 1].eSubInitialized += new SubOrdinateInitialized(CheckForMasterStart);
lClientSockets[lClientSockets.Count - 1].eMasterRestart += new MasterRestarted(MasterSuccessfullyRestarted);
lClientSockets[lClientSockets.Count - 1].eSyncJackstate += new RecievedSyncJackState(SendTemporalSyncData);
lClientSockets[lClientSockets.Count - 1].eStandAloneInitialized += new StandAloneInitialized(ConfirmTemporalSyncDisabled);
if (eSocketListChanged != null) if (eSocketListChanged != null)
{ {
eSocketListChanged(lClientSockets); eSocketListChanged(lClientSockets);
@@ -436,6 +632,21 @@ namespace KinectServer
lClientSockets[i].bLatestFrameReceived = true; lClientSockets[i].bLatestFrameReceived = true;
} }
else if (buffer[0] == 4)
{
lClientSockets[i].ReceiveTemporalSyncStatus();
}
else if(buffer[0] == 5)
{
lClientSockets[i].RecieveMasterHasRestarted();
}
else if(buffer[0] == 6)
{
lClientSockets[i].RecieveDeviceSyncState();
}
buffer = lClientSockets[i].Receive(1); buffer = lClientSockets[i].Receive(1);
} }
} }
+14
View File
@@ -42,6 +42,12 @@ namespace KinectServer
public bool bMergeScansForSave = true; public bool bMergeScansForSave = true;
public bool bSaveAsBinaryPLY = true; public bool bSaveAsBinaryPLY = true;
public bool bSyncEnabled = false;
public bool bAutoExposureEnabled = true;
public int nExposureStep = -8;
public KinectSettings() public KinectSettings()
{ {
aMinBounds[0] = -5f; aMinBounds[0] = -5f;
@@ -100,6 +106,14 @@ namespace KinectServer
bTemp = BitConverter.GetBytes(iCompressionLevel); bTemp = BitConverter.GetBytes(iCompressionLevel);
lData.AddRange(bTemp); lData.AddRange(bTemp);
if (bAutoExposureEnabled)
lData.Add(1);
else
lData.Add(0);
bTemp = BitConverter.GetBytes(nExposureStep);
lData.AddRange(bTemp);
return lData; return lData;
} }
} }
+175 -7
View File
@@ -18,11 +18,15 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Net.Sockets; using System.Net.Sockets;
using OpenTK.Graphics;
namespace KinectServer namespace KinectServer
{ {
public delegate void SocketChangedHandler(); public delegate void SocketChangedHandler();
public delegate void SubOrdinateInitialized();
public delegate void MasterRestarted();
public delegate void RecievedSyncJackState();
public delegate void StandAloneInitialized();
public class KinectSocket public class KinectSocket
{ {
@@ -33,8 +37,20 @@ namespace KinectServer
public bool bStoredFrameReceived = false; public bool bStoredFrameReceived = false;
public bool bNoMoreStoredFrames = true; public bool bNoMoreStoredFrames = true;
public bool bCalibrated = false; public bool bCalibrated = false;
public bool bSubStarted = false;
public bool bMasterStarted = false;
public enum eTempSyncConfig { MASTER, SUBORDINATE, STANDALONE, UNKNOWN }
//Shows how the *Device* is configured (Determined only by the Sync-Cables hooked up to the device)
public eTempSyncConfig currentDeviceTempSyncState = eTempSyncConfig.STANDALONE;
//Shows how the Client-Software is configured (This is set by the server)
public eTempSyncConfig currentClientTempSyncState = eTempSyncConfig.STANDALONE;
//The pose of the sensor in the scene (used by the OpenGLWindow to show the sensor) //The pose of the sensor in the scene (used by the OpenGLWindow to show the sensor)
public AffineTransform oCameraPose = new AffineTransform(); public AffineTransform oCameraPose = new AffineTransform();
//The transform that maps the vertices in the sensor coordinate system to the world corrdinate system. //The transform that maps the vertices in the sensor coordinate system to the world corrdinate system.
public AffineTransform oWorldTransform = new AffineTransform(); public AffineTransform oWorldTransform = new AffineTransform();
@@ -45,11 +61,17 @@ namespace KinectServer
public List<Body> lBodies = new List<Body>(); public List<Body> lBodies = new List<Body>();
public event SocketChangedHandler eChanged; public event SocketChangedHandler eChanged;
public event SubOrdinateInitialized eSubInitialized;
public event MasterRestarted eMasterRestart;
public event RecievedSyncJackState eSyncJackstate;
public event StandAloneInitialized eStandAloneInitialized;
public KinectSocket(Socket clientSocket) public KinectSocket(Socket clientSocket)
{ {
oSocket = clientSocket; oSocket = clientSocket;
sSocketState = oSocket.RemoteEndPoint.ToString() + " Calibrated = false"; sSocketState = oSocket.RemoteEndPoint.ToString() + " Calibrated = false";
UpdateSocketState();
} }
public void CaptureFrame() public void CaptureFrame()
@@ -121,6 +143,84 @@ namespace KinectServer
SendByte(); SendByte();
} }
/// <summary>
/// Send the device the command to restart with Temporal Sync Enabled or Disabled
/// </summary>
/// <param name="tempSyncOn">Enable/Disable Temporal Sync</param>
/// <param name="syncOffSetMultiplier">Only set when this device should be a subordinate. Should be a unique number in ascending order for each sub</param>
public void SendTemporalSyncStatus(bool tempSyncOn, byte syncOffSetMultiplier)
{
bSubStarted = false;
currentClientTempSyncState = eTempSyncConfig.UNKNOWN;
if (tempSyncOn)
{
byte[] data = new byte[2];
data[0] = 7;
data[1] = syncOffSetMultiplier;
if (SocketConnected())
oSocket.Send(data);
}
else
{
byteToSend[0] = 8;
SendByte();
}
}
/// <summary>
/// Sends the master device the command to Start. Should only be called when all subs have started
/// </summary>
public void SendMasterInitialize()
{
byteToSend[0] = 9;
SendByte();
}
/// <summary>
/// Asks the client in which way the Sync-Cables are hooked up to the device
/// </summary>
public void RequestTempSyncState()
{
currentDeviceTempSyncState = eTempSyncConfig.UNKNOWN;
byteToSend[0] = 10;
SendByte();
}
public void RecieveDeviceSyncState()
{
byte tempSyncState;
byte[] buffer = new byte[1024];
while (oSocket.Available == 0)
{
if (!SocketConnected())
return;
}
oSocket.Receive(buffer, 3, SocketFlags.None);
tempSyncState = buffer[0];
if (tempSyncState == 0)
{
currentDeviceTempSyncState = eTempSyncConfig.SUBORDINATE;
}
else if (tempSyncState == 1)
{
currentDeviceTempSyncState = eTempSyncConfig.MASTER;
}
else if (tempSyncState == 2)
{
currentDeviceTempSyncState = eTempSyncConfig.STANDALONE;
}
eSyncJackstate.Invoke();
}
public void ReceiveCalibrationData() public void ReceiveCalibrationData()
{ {
bCalibrated = true; bCalibrated = true;
@@ -148,6 +248,53 @@ namespace KinectServer
UpdateSocketState(); UpdateSocketState();
} }
//Gets the TemporalSyncStatus from the device
public void ReceiveTemporalSyncStatus()
{
byte tempSyncState;
byte[] buffer = new byte[1024];
while (oSocket.Available == 0)
{
if (!SocketConnected())
return;
}
oSocket.Receive(buffer, 3, SocketFlags.None);
tempSyncState = buffer[0];
if (tempSyncState == 0)
{
currentClientTempSyncState = eTempSyncConfig.SUBORDINATE;
bSubStarted = true;
bMasterStarted = false;
eSubInitialized?.Invoke();
}
else if(tempSyncState == 1)
{
currentClientTempSyncState = eTempSyncConfig.MASTER;
bSubStarted = false;
}
else if (tempSyncState == 2)
{
currentClientTempSyncState = eTempSyncConfig.STANDALONE;
bSubStarted = false;
bMasterStarted = false;
eStandAloneInitialized?.Invoke();
}
UpdateSocketState();
}
public void RecieveMasterHasRestarted()
{
bMasterStarted = true;
eMasterRestart?.Invoke();
}
public void ReceiveFrame() public void ReceiveFrame()
{ {
lFrameRGB.Clear(); lFrameRGB.Clear();
@@ -165,6 +312,9 @@ namespace KinectServer
oSocket.Receive(buffer, 8, SocketFlags.None); oSocket.Receive(buffer, 8, SocketFlags.None);
nToRead = BitConverter.ToInt32(buffer, 0); nToRead = BitConverter.ToInt32(buffer, 0);
int iCompressed = BitConverter.ToInt32(buffer, 4); int iCompressed = BitConverter.ToInt32(buffer, 4);
if (nToRead == -1) if (nToRead == -1)
@@ -173,6 +323,14 @@ namespace KinectServer
return; return;
} }
//Sometimes we recieve negative values when the cameras are restarting, I don't know why yet.
//I'm just patching this up for now.s
if (nToRead <= 0)
{
return;
}
buffer = new byte[nToRead]; buffer = new byte[nToRead];
int nAlreadyRead = 0; int nAlreadyRead = 0;
@@ -293,13 +451,23 @@ namespace KinectServer
public void UpdateSocketState() public void UpdateSocketState()
{ {
if (bCalibrated) string tempSyncMessage = "";
sSocketState = oSocket.RemoteEndPoint.ToString() + " Calibrated = true";
else
sSocketState = oSocket.RemoteEndPoint.ToString() + " Calibrated = false";
if (eChanged != null) switch (currentClientTempSyncState)
eChanged(); {
case eTempSyncConfig.MASTER:
tempSyncMessage = "[MASTER]";
break;
case eTempSyncConfig.SUBORDINATE:
tempSyncMessage = "[SUBORDINATE]";
break;
default:
break;
}
sSocketState = oSocket.RemoteEndPoint.ToString() + " Calibrated = " + bCalibrated + " " + tempSyncMessage;
eChanged?.Invoke();
} }
} }
} }
+18 -5
View File
@@ -125,10 +125,16 @@ namespace KinectServer
//Opens the settings form //Opens the settings form
private void btSettings_Click(object sender, EventArgs e) private void btSettings_Click(object sender, EventArgs e)
{ {
SettingsForm form = new SettingsForm(); if(oServer.GetSettingsForm() == null)
form.oSettings = oSettings; {
form.oServer = oServer; SettingsForm form = new SettingsForm();
form.Show(); form.oSettings = oSettings;
form.oServer = oServer;
form.Show();
oServer.SetSettingsForm(form);
oServer.SetMainWindowForm(this);
}
} }
//Performs recording which is synchronized frame capture. //Performs recording which is synchronized frame capture.
@@ -263,6 +269,12 @@ namespace KinectServer
while (!worker.CancellationPending) while (!worker.CancellationPending)
{ {
Thread.Sleep(1); Thread.Sleep(1);
if (!oServer.GetAllDevicesInitialized())
{
continue;
}
oServer.GetLatestFrame(lFramesRGB, lFramesVerts, lFramesBody); oServer.GetLatestFrame(lFramesRGB, lFramesVerts, lFramesBody);
//Update the vertex and color lists that are common between this class and the OpenGLWindow. //Update the vertex and color lists that are common between this class and the OpenGLWindow.
@@ -472,7 +484,7 @@ namespace KinectServer
OpenGLWorker.RunWorkerAsync(); OpenGLWorker.RunWorkerAsync();
} }
private void SetStatusBarOnTimer(string message, int milliseconds) public void SetStatusBarOnTimer(string message, int milliseconds)
{ {
statusLabel.Text = message; statusLabel.Text = message;
@@ -496,6 +508,7 @@ namespace KinectServer
for (int i = 0; i < socketList.Count; i++) for (int i = 0; i < socketList.Count; i++)
listBoxItems.Add(socketList[i].sSocketState); listBoxItems.Add(socketList[i].sSocketState);
lClientListBox.DataSource = listBoxItems; lClientListBox.DataSource = listBoxItems;
} }
} }
+286 -211
View File
@@ -33,6 +33,15 @@
this.lbICPIters = new System.Windows.Forms.Label(); this.lbICPIters = new System.Windows.Forms.Label();
this.txtICPIters = new System.Windows.Forms.TextBox(); this.txtICPIters = new System.Windows.Forms.TextBox();
this.grClient = new System.Windows.Forms.GroupBox(); this.grClient = new System.Windows.Forms.GroupBox();
this.grExposure = new System.Windows.Forms.GroupBox();
this.lbManualExposure = new System.Windows.Forms.Label();
this.chAutoExposureEnabled = new System.Windows.Forms.CheckBox();
this.trManualExposure = new System.Windows.Forms.TrackBar();
this.grTempSync = new System.Windows.Forms.GroupBox();
this.btSyncDisable = new System.Windows.Forms.Button();
this.btSyncEnable = new System.Windows.Forms.Button();
this.lbTempSync = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.grBody = new System.Windows.Forms.GroupBox(); this.grBody = new System.Windows.Forms.GroupBox();
this.chSkeletons = new System.Windows.Forms.CheckBox(); this.chSkeletons = new System.Windows.Forms.CheckBox();
this.chBodyData = new System.Windows.Forms.CheckBox(); this.chBodyData = new System.Windows.Forms.CheckBox();
@@ -72,14 +81,17 @@
this.lbFilterDistance = new System.Windows.Forms.Label(); this.lbFilterDistance = new System.Windows.Forms.Label();
this.txtFilterDistance = new System.Windows.Forms.TextBox(); this.txtFilterDistance = new System.Windows.Forms.TextBox();
this.grServer = new System.Windows.Forms.GroupBox(); this.grServer = new System.Windows.Forms.GroupBox();
this.cbCompressionLevel = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.rBinaryPly = new System.Windows.Forms.RadioButton(); this.rBinaryPly = new System.Windows.Forms.RadioButton();
this.lbFormat = new System.Windows.Forms.Label(); this.lbFormat = new System.Windows.Forms.Label();
this.rAsciiPly = new System.Windows.Forms.RadioButton(); this.rAsciiPly = new System.Windows.Forms.RadioButton();
this.txtRefinIters = new System.Windows.Forms.TextBox(); this.txtRefinIters = new System.Windows.Forms.TextBox();
this.lbOuterIters = new System.Windows.Forms.Label(); this.lbOuterIters = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.cbCompressionLevel = new System.Windows.Forms.ComboBox();
this.grClient.SuspendLayout(); this.grClient.SuspendLayout();
this.grExposure.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trManualExposure)).BeginInit();
this.grTempSync.SuspendLayout();
this.grBody.SuspendLayout(); this.grBody.SuspendLayout();
this.grMarkers.SuspendLayout(); this.grMarkers.SuspendLayout();
this.grBounding.SuspendLayout(); this.grBounding.SuspendLayout();
@@ -90,20 +102,18 @@
// lbMerge // lbMerge
// //
this.lbMerge.AutoSize = true; this.lbMerge.AutoSize = true;
this.lbMerge.Location = new System.Drawing.Point(7, 69); this.lbMerge.Location = new System.Drawing.Point(5, 45);
this.lbMerge.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbMerge.Name = "lbMerge"; this.lbMerge.Name = "lbMerge";
this.lbMerge.Size = new System.Drawing.Size(99, 20); this.lbMerge.Size = new System.Drawing.Size(69, 13);
this.lbMerge.TabIndex = 22; this.lbMerge.TabIndex = 22;
this.lbMerge.Text = "Scan saving:"; this.lbMerge.Text = "Scan saving:";
// //
// chMerge // chMerge
// //
this.chMerge.AutoSize = true; this.chMerge.AutoSize = true;
this.chMerge.Location = new System.Drawing.Point(156, 70); this.chMerge.Location = new System.Drawing.Point(104, 45);
this.chMerge.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.chMerge.Name = "chMerge"; this.chMerge.Name = "chMerge";
this.chMerge.Size = new System.Drawing.Size(126, 24); this.chMerge.Size = new System.Drawing.Size(86, 17);
this.chMerge.TabIndex = 23; this.chMerge.TabIndex = 23;
this.chMerge.Text = "merge scans"; this.chMerge.Text = "merge scans";
this.chMerge.UseVisualStyleBackColor = true; this.chMerge.UseVisualStyleBackColor = true;
@@ -112,46 +122,143 @@
// lbICPIters // lbICPIters
// //
this.lbICPIters.AutoSize = true; this.lbICPIters.AutoSize = true;
this.lbICPIters.Location = new System.Drawing.Point(7, 34); this.lbICPIters.Location = new System.Drawing.Point(5, 22);
this.lbICPIters.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbICPIters.Name = "lbICPIters"; this.lbICPIters.Name = "lbICPIters";
this.lbICPIters.Size = new System.Drawing.Size(128, 20); this.lbICPIters.Size = new System.Drawing.Size(86, 13);
this.lbICPIters.TabIndex = 24; this.lbICPIters.TabIndex = 24;
this.lbICPIters.Text = "Num of ICP iters:"; this.lbICPIters.Text = "Num of ICP iters:";
// //
// txtICPIters // txtICPIters
// //
this.txtICPIters.Location = new System.Drawing.Point(156, 31); this.txtICPIters.Location = new System.Drawing.Point(104, 20);
this.txtICPIters.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtICPIters.Name = "txtICPIters"; this.txtICPIters.Name = "txtICPIters";
this.txtICPIters.Size = new System.Drawing.Size(55, 26); this.txtICPIters.Size = new System.Drawing.Size(38, 20);
this.txtICPIters.TabIndex = 25; this.txtICPIters.TabIndex = 25;
this.txtICPIters.TextChanged += new System.EventHandler(this.txtICPIters_TextChanged); this.txtICPIters.TextChanged += new System.EventHandler(this.txtICPIters_TextChanged);
// //
// grClient // grClient
// //
this.grClient.Controls.Add(this.grExposure);
this.grClient.Controls.Add(this.grTempSync);
this.grClient.Controls.Add(this.grBody); this.grClient.Controls.Add(this.grBody);
this.grClient.Controls.Add(this.grMarkers); this.grClient.Controls.Add(this.grMarkers);
this.grClient.Controls.Add(this.grBounding); this.grClient.Controls.Add(this.grBounding);
this.grClient.Controls.Add(this.grFiltering); this.grClient.Controls.Add(this.grFiltering);
this.grClient.Location = new System.Drawing.Point(18, 18); this.grClient.Location = new System.Drawing.Point(12, 12);
this.grClient.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grClient.Name = "grClient"; this.grClient.Name = "grClient";
this.grClient.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); this.grClient.Size = new System.Drawing.Size(632, 408);
this.grClient.Size = new System.Drawing.Size(948, 447);
this.grClient.TabIndex = 43; this.grClient.TabIndex = 43;
this.grClient.TabStop = false; this.grClient.TabStop = false;
this.grClient.Text = "KinectClient settings"; this.grClient.Text = "KinectClient settings";
//
// grExposure
//
this.grExposure.Controls.Add(this.lbManualExposure);
this.grExposure.Controls.Add(this.chAutoExposureEnabled);
this.grExposure.Controls.Add(this.trManualExposure);
this.grExposure.Location = new System.Drawing.Point(9, 283);
this.grExposure.Name = "grExposure";
this.grExposure.Size = new System.Drawing.Size(249, 115);
this.grExposure.TabIndex = 49;
this.grExposure.TabStop = false;
this.grExposure.Text = "Exposure Settings";
//
// lbManualExposure
//
this.lbManualExposure.AutoSize = true;
this.lbManualExposure.Location = new System.Drawing.Point(79, 52);
this.lbManualExposure.Name = "lbManualExposure";
this.lbManualExposure.Size = new System.Drawing.Size(91, 13);
this.lbManualExposure.TabIndex = 7;
this.lbManualExposure.Text = "Manual exposure:";
//
// chAutoExposureEnabled
//
this.chAutoExposureEnabled.AutoSize = true;
this.chAutoExposureEnabled.Checked = true;
this.chAutoExposureEnabled.CheckState = System.Windows.Forms.CheckState.Checked;
this.chAutoExposureEnabled.Location = new System.Drawing.Point(11, 20);
this.chAutoExposureEnabled.Name = "chAutoExposureEnabled";
this.chAutoExposureEnabled.Size = new System.Drawing.Size(135, 17);
this.chAutoExposureEnabled.TabIndex = 6;
this.chAutoExposureEnabled.Text = "Auto exposure enabled";
this.chAutoExposureEnabled.UseVisualStyleBackColor = true;
this.chAutoExposureEnabled.CheckedChanged += new System.EventHandler(this.chAutoExposureEnabled_CheckedChanged);
//
// trManualExposure
//
this.trManualExposure.Enabled = false;
this.trManualExposure.LargeChange = 1;
this.trManualExposure.Location = new System.Drawing.Point(6, 62);
this.trManualExposure.Maximum = -5;
this.trManualExposure.Minimum = -11;
this.trManualExposure.Name = "trManualExposure";
this.trManualExposure.Size = new System.Drawing.Size(237, 45);
this.trManualExposure.TabIndex = 5;
this.trManualExposure.Value = -8;
this.trManualExposure.Scroll += new System.EventHandler(this.trManualExposure_Scroll);
//
// grTempSync
//
this.grTempSync.Controls.Add(this.btSyncDisable);
this.grTempSync.Controls.Add(this.btSyncEnable);
this.grTempSync.Controls.Add(this.lbTempSync);
this.grTempSync.Controls.Add(this.label1);
this.grTempSync.Location = new System.Drawing.Point(271, 211);
this.grTempSync.Name = "grTempSync";
this.grTempSync.Size = new System.Drawing.Size(355, 97);
this.grTempSync.TabIndex = 48;
this.grTempSync.TabStop = false;
this.grTempSync.Text = "Temporal Sync";
//
// btSyncDisable
//
this.btSyncDisable.Location = new System.Drawing.Point(104, 19);
this.btSyncDisable.Name = "btSyncDisable";
this.btSyncDisable.Size = new System.Drawing.Size(92, 23);
this.btSyncDisable.TabIndex = 4;
this.btSyncDisable.Text = "Disable";
this.btSyncDisable.UseVisualStyleBackColor = true;
this.btSyncDisable.Click += new System.EventHandler(this.btSyncDisable_click);
//
// btSyncEnable
//
this.btSyncEnable.Location = new System.Drawing.Point(6, 19);
this.btSyncEnable.Name = "btSyncEnable";
this.btSyncEnable.Size = new System.Drawing.Size(92, 23);
this.btSyncEnable.TabIndex = 3;
this.btSyncEnable.Text = "Enable";
this.btSyncEnable.UseVisualStyleBackColor = true;
this.btSyncEnable.Click += new System.EventHandler(this.btSyncEnable_click);
//
// lbTempSync
//
this.lbTempSync.Location = new System.Drawing.Point(3, 45);
this.lbTempSync.Name = "lbTempSync";
this.lbTempSync.Size = new System.Drawing.Size(342, 47);
this.lbTempSync.TabIndex = 2;
this.lbTempSync.Text = "Before activating, make sure that all Kinects are connected to the server and pro" +
"perly connected via the sync cables. When Temporal Sync is activated, the exposu" +
"re needs to be set manually!";
//
// label1
//
this.label1.Location = new System.Drawing.Point(7, 41);
this.label1.MaximumSize = new System.Drawing.Size(0, 60);
this.label1.MinimumSize = new System.Drawing.Size(0, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 30);
this.label1.TabIndex = 1;
this.label1.Text = "Notice: All devices need to be connected to the server and via sync cabel before" +
" enabeling! First Device in Server List will become the master";
// //
// grBody // grBody
// //
this.grBody.Controls.Add(this.chSkeletons); this.grBody.Controls.Add(this.chSkeletons);
this.grBody.Controls.Add(this.chBodyData); this.grBody.Controls.Add(this.chBodyData);
this.grBody.Location = new System.Drawing.Point(14, 325); this.grBody.Location = new System.Drawing.Point(9, 211);
this.grBody.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grBody.Name = "grBody"; this.grBody.Name = "grBody";
this.grBody.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); this.grBody.Size = new System.Drawing.Size(249, 66);
this.grBody.Size = new System.Drawing.Size(374, 101);
this.grBody.TabIndex = 47; this.grBody.TabIndex = 47;
this.grBody.TabStop = false; this.grBody.TabStop = false;
this.grBody.Text = "Body data"; this.grBody.Text = "Body data";
@@ -159,10 +266,10 @@
// chSkeletons // chSkeletons
// //
this.chSkeletons.AutoSize = true; this.chSkeletons.AutoSize = true;
this.chSkeletons.Location = new System.Drawing.Point(16, 63); this.chSkeletons.Enabled = false;
this.chSkeletons.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.chSkeletons.Location = new System.Drawing.Point(11, 41);
this.chSkeletons.Name = "chSkeletons"; this.chSkeletons.Name = "chSkeletons";
this.chSkeletons.Size = new System.Drawing.Size(220, 24); this.chSkeletons.Size = new System.Drawing.Size(154, 17);
this.chSkeletons.TabIndex = 21; this.chSkeletons.TabIndex = 21;
this.chSkeletons.Text = "show skeletons in live view"; this.chSkeletons.Text = "show skeletons in live view";
this.chSkeletons.UseVisualStyleBackColor = true; this.chSkeletons.UseVisualStyleBackColor = true;
@@ -171,10 +278,10 @@
// chBodyData // chBodyData
// //
this.chBodyData.AutoSize = true; this.chBodyData.AutoSize = true;
this.chBodyData.Location = new System.Drawing.Point(16, 29); this.chBodyData.Enabled = false;
this.chBodyData.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.chBodyData.Location = new System.Drawing.Point(11, 19);
this.chBodyData.Name = "chBodyData"; this.chBodyData.Name = "chBodyData";
this.chBodyData.Size = new System.Drawing.Size(167, 24); this.chBodyData.Size = new System.Drawing.Size(113, 17);
this.chBodyData.TabIndex = 19; this.chBodyData.TabIndex = 19;
this.chBodyData.Text = "stream only bodies"; this.chBodyData.Text = "stream only bodies";
this.chBodyData.UseVisualStyleBackColor = true; this.chBodyData.UseVisualStyleBackColor = true;
@@ -198,11 +305,9 @@
this.grMarkers.Controls.Add(this.txtTranslationX); this.grMarkers.Controls.Add(this.txtTranslationX);
this.grMarkers.Controls.Add(this.lisMarkers); this.grMarkers.Controls.Add(this.lisMarkers);
this.grMarkers.Controls.Add(this.txtTranslationY); this.grMarkers.Controls.Add(this.txtTranslationY);
this.grMarkers.Location = new System.Drawing.Point(406, 29); this.grMarkers.Location = new System.Drawing.Point(271, 19);
this.grMarkers.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grMarkers.Name = "grMarkers"; this.grMarkers.Name = "grMarkers";
this.grMarkers.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); this.grMarkers.Size = new System.Drawing.Size(353, 185);
this.grMarkers.Size = new System.Drawing.Size(530, 285);
this.grMarkers.TabIndex = 45; this.grMarkers.TabIndex = 45;
this.grMarkers.TabStop = false; this.grMarkers.TabStop = false;
this.grMarkers.Text = "Calibration markers"; this.grMarkers.Text = "Calibration markers";
@@ -210,19 +315,17 @@
// lbX2 // lbX2
// //
this.lbX2.AutoSize = true; this.lbX2.AutoSize = true;
this.lbX2.Location = new System.Drawing.Point(345, 29); this.lbX2.Location = new System.Drawing.Point(230, 19);
this.lbX2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbX2.Name = "lbX2"; this.lbX2.Name = "lbX2";
this.lbX2.Size = new System.Drawing.Size(20, 20); this.lbX2.Size = new System.Drawing.Size(14, 13);
this.lbX2.TabIndex = 49; this.lbX2.TabIndex = 49;
this.lbX2.Text = "X"; this.lbX2.Text = "X";
// //
// btRemove // btRemove
// //
this.btRemove.Location = new System.Drawing.Point(350, 195); this.btRemove.Location = new System.Drawing.Point(233, 127);
this.btRemove.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btRemove.Name = "btRemove"; this.btRemove.Name = "btRemove";
this.btRemove.Size = new System.Drawing.Size(138, 35); this.btRemove.Size = new System.Drawing.Size(92, 23);
this.btRemove.TabIndex = 59; this.btRemove.TabIndex = 59;
this.btRemove.Text = "Remove marker"; this.btRemove.Text = "Remove marker";
this.btRemove.UseVisualStyleBackColor = true; this.btRemove.UseVisualStyleBackColor = true;
@@ -230,76 +333,68 @@
// //
// txtOrientationZ // txtOrientationZ
// //
this.txtOrientationZ.Location = new System.Drawing.Point(458, 58); this.txtOrientationZ.Location = new System.Drawing.Point(305, 38);
this.txtOrientationZ.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtOrientationZ.Name = "txtOrientationZ"; this.txtOrientationZ.Name = "txtOrientationZ";
this.txtOrientationZ.Size = new System.Drawing.Size(55, 26); this.txtOrientationZ.Size = new System.Drawing.Size(38, 20);
this.txtOrientationZ.TabIndex = 48; this.txtOrientationZ.TabIndex = 48;
this.txtOrientationZ.TextChanged += new System.EventHandler(this.txtOrientationZ_TextChanged); this.txtOrientationZ.TextChanged += new System.EventHandler(this.txtOrientationZ_TextChanged);
// //
// txtId // txtId
// //
this.txtId.Location = new System.Drawing.Point(326, 143); this.txtId.Location = new System.Drawing.Point(217, 93);
this.txtId.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtId.Name = "txtId"; this.txtId.Name = "txtId";
this.txtId.Size = new System.Drawing.Size(55, 26); this.txtId.Size = new System.Drawing.Size(38, 20);
this.txtId.TabIndex = 58; this.txtId.TabIndex = 58;
this.txtId.TextChanged += new System.EventHandler(this.txtId_TextChanged); this.txtId.TextChanged += new System.EventHandler(this.txtId_TextChanged);
// //
// lbY2 // lbY2
// //
this.lbY2.AutoSize = true; this.lbY2.AutoSize = true;
this.lbY2.Location = new System.Drawing.Point(411, 29); this.lbY2.Location = new System.Drawing.Point(274, 19);
this.lbY2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbY2.Name = "lbY2"; this.lbY2.Name = "lbY2";
this.lbY2.Size = new System.Drawing.Size(20, 20); this.lbY2.Size = new System.Drawing.Size(14, 13);
this.lbY2.TabIndex = 50; this.lbY2.TabIndex = 50;
this.lbY2.Text = "Y"; this.lbY2.Text = "Y";
// //
// txtOrientationY // txtOrientationY
// //
this.txtOrientationY.Location = new System.Drawing.Point(392, 58); this.txtOrientationY.Location = new System.Drawing.Point(261, 38);
this.txtOrientationY.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtOrientationY.Name = "txtOrientationY"; this.txtOrientationY.Name = "txtOrientationY";
this.txtOrientationY.Size = new System.Drawing.Size(55, 26); this.txtOrientationY.Size = new System.Drawing.Size(38, 20);
this.txtOrientationY.TabIndex = 47; this.txtOrientationY.TabIndex = 47;
this.txtOrientationY.TextChanged += new System.EventHandler(this.txtOrientationY_TextChanged); this.txtOrientationY.TextChanged += new System.EventHandler(this.txtOrientationY_TextChanged);
// //
// lbId // lbId
// //
this.lbId.AutoSize = true; this.lbId.AutoSize = true;
this.lbId.Location = new System.Drawing.Point(198, 148); this.lbId.Location = new System.Drawing.Point(132, 96);
this.lbId.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbId.Name = "lbId"; this.lbId.Name = "lbId";
this.lbId.Size = new System.Drawing.Size(78, 20); this.lbId.Size = new System.Drawing.Size(54, 13);
this.lbId.TabIndex = 57; this.lbId.TabIndex = 57;
this.lbId.Text = "Marker id:"; this.lbId.Text = "Marker id:";
// //
// lbZ2 // lbZ2
// //
this.lbZ2.AutoSize = true; this.lbZ2.AutoSize = true;
this.lbZ2.Location = new System.Drawing.Point(476, 29); this.lbZ2.Location = new System.Drawing.Point(317, 19);
this.lbZ2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbZ2.Name = "lbZ2"; this.lbZ2.Name = "lbZ2";
this.lbZ2.Size = new System.Drawing.Size(19, 20); this.lbZ2.Size = new System.Drawing.Size(14, 13);
this.lbZ2.TabIndex = 51; this.lbZ2.TabIndex = 51;
this.lbZ2.Text = "Z"; this.lbZ2.Text = "Z";
// //
// txtOrientationX // txtOrientationX
// //
this.txtOrientationX.Location = new System.Drawing.Point(326, 58); this.txtOrientationX.Location = new System.Drawing.Point(217, 38);
this.txtOrientationX.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtOrientationX.Name = "txtOrientationX"; this.txtOrientationX.Name = "txtOrientationX";
this.txtOrientationX.Size = new System.Drawing.Size(55, 26); this.txtOrientationX.Size = new System.Drawing.Size(38, 20);
this.txtOrientationX.TabIndex = 46; this.txtOrientationX.TabIndex = 46;
this.txtOrientationX.TextChanged += new System.EventHandler(this.txtOrientationX_TextChanged); this.txtOrientationX.TextChanged += new System.EventHandler(this.txtOrientationX_TextChanged);
// //
// btAdd // btAdd
// //
this.btAdd.Location = new System.Drawing.Point(202, 195); this.btAdd.Location = new System.Drawing.Point(135, 127);
this.btAdd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btAdd.Name = "btAdd"; this.btAdd.Name = "btAdd";
this.btAdd.Size = new System.Drawing.Size(138, 35); this.btAdd.Size = new System.Drawing.Size(92, 23);
this.btAdd.TabIndex = 56; this.btAdd.TabIndex = 56;
this.btAdd.Text = "Add marker"; this.btAdd.Text = "Add marker";
this.btAdd.UseVisualStyleBackColor = true; this.btAdd.UseVisualStyleBackColor = true;
@@ -308,58 +403,51 @@
// lbTranslation // lbTranslation
// //
this.lbTranslation.AutoSize = true; this.lbTranslation.AutoSize = true;
this.lbTranslation.Location = new System.Drawing.Point(198, 105); this.lbTranslation.Location = new System.Drawing.Point(132, 68);
this.lbTranslation.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbTranslation.Name = "lbTranslation"; this.lbTranslation.Name = "lbTranslation";
this.lbTranslation.Size = new System.Drawing.Size(91, 20); this.lbTranslation.Size = new System.Drawing.Size(62, 13);
this.lbTranslation.TabIndex = 52; this.lbTranslation.TabIndex = 52;
this.lbTranslation.Text = "Translation:"; this.lbTranslation.Text = "Translation:";
// //
// lbOrientation // lbOrientation
// //
this.lbOrientation.AutoSize = true; this.lbOrientation.AutoSize = true;
this.lbOrientation.Location = new System.Drawing.Point(198, 63); this.lbOrientation.Location = new System.Drawing.Point(132, 41);
this.lbOrientation.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbOrientation.Name = "lbOrientation"; this.lbOrientation.Name = "lbOrientation";
this.lbOrientation.Size = new System.Drawing.Size(91, 20); this.lbOrientation.Size = new System.Drawing.Size(61, 13);
this.lbOrientation.TabIndex = 45; this.lbOrientation.TabIndex = 45;
this.lbOrientation.Text = "Orientation:"; this.lbOrientation.Text = "Orientation:";
// //
// txtTranslationZ // txtTranslationZ
// //
this.txtTranslationZ.Location = new System.Drawing.Point(458, 100); this.txtTranslationZ.Location = new System.Drawing.Point(305, 65);
this.txtTranslationZ.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtTranslationZ.Name = "txtTranslationZ"; this.txtTranslationZ.Name = "txtTranslationZ";
this.txtTranslationZ.Size = new System.Drawing.Size(55, 26); this.txtTranslationZ.Size = new System.Drawing.Size(38, 20);
this.txtTranslationZ.TabIndex = 55; this.txtTranslationZ.TabIndex = 55;
this.txtTranslationZ.TextChanged += new System.EventHandler(this.txtTranslationZ_TextChanged); this.txtTranslationZ.TextChanged += new System.EventHandler(this.txtTranslationZ_TextChanged);
// //
// txtTranslationX // txtTranslationX
// //
this.txtTranslationX.Location = new System.Drawing.Point(326, 100); this.txtTranslationX.Location = new System.Drawing.Point(217, 65);
this.txtTranslationX.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtTranslationX.Name = "txtTranslationX"; this.txtTranslationX.Name = "txtTranslationX";
this.txtTranslationX.Size = new System.Drawing.Size(55, 26); this.txtTranslationX.Size = new System.Drawing.Size(38, 20);
this.txtTranslationX.TabIndex = 53; this.txtTranslationX.TabIndex = 53;
this.txtTranslationX.TextChanged += new System.EventHandler(this.txtTranslationX_TextChanged); this.txtTranslationX.TextChanged += new System.EventHandler(this.txtTranslationX_TextChanged);
// //
// lisMarkers // lisMarkers
// //
this.lisMarkers.FormattingEnabled = true; this.lisMarkers.FormattingEnabled = true;
this.lisMarkers.ItemHeight = 20; this.lisMarkers.Location = new System.Drawing.Point(6, 41);
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.Name = "lisMarkers";
this.lisMarkers.Size = new System.Drawing.Size(178, 164); this.lisMarkers.Size = new System.Drawing.Size(120, 108);
this.lisMarkers.TabIndex = 43; this.lisMarkers.TabIndex = 43;
this.lisMarkers.SelectedIndexChanged += new System.EventHandler(this.lisMarkers_SelectedIndexChanged); this.lisMarkers.SelectedIndexChanged += new System.EventHandler(this.lisMarkers_SelectedIndexChanged);
// //
// txtTranslationY // txtTranslationY
// //
this.txtTranslationY.Location = new System.Drawing.Point(392, 100); this.txtTranslationY.Location = new System.Drawing.Point(261, 65);
this.txtTranslationY.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtTranslationY.Name = "txtTranslationY"; this.txtTranslationY.Name = "txtTranslationY";
this.txtTranslationY.Size = new System.Drawing.Size(55, 26); this.txtTranslationY.Size = new System.Drawing.Size(38, 20);
this.txtTranslationY.TabIndex = 54; this.txtTranslationY.TabIndex = 54;
this.txtTranslationY.TextChanged += new System.EventHandler(this.txtTranslationY_TextChanged); this.txtTranslationY.TextChanged += new System.EventHandler(this.txtTranslationY_TextChanged);
// //
@@ -376,11 +464,9 @@
this.grBounding.Controls.Add(this.lbZ); this.grBounding.Controls.Add(this.lbZ);
this.grBounding.Controls.Add(this.lbY); this.grBounding.Controls.Add(this.lbY);
this.grBounding.Controls.Add(this.lbX); this.grBounding.Controls.Add(this.lbX);
this.grBounding.Location = new System.Drawing.Point(14, 29); this.grBounding.Location = new System.Drawing.Point(9, 19);
this.grBounding.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grBounding.Name = "grBounding"; this.grBounding.Name = "grBounding";
this.grBounding.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); this.grBounding.Size = new System.Drawing.Size(249, 91);
this.grBounding.Size = new System.Drawing.Size(374, 140);
this.grBounding.TabIndex = 46; this.grBounding.TabIndex = 46;
this.grBounding.TabStop = false; this.grBounding.TabStop = false;
this.grBounding.Text = "Bounding box"; this.grBounding.Text = "Bounding box";
@@ -388,104 +474,93 @@
// lbMin // lbMin
// //
this.lbMin.AutoSize = true; this.lbMin.AutoSize = true;
this.lbMin.Location = new System.Drawing.Point(12, 58); this.lbMin.Location = new System.Drawing.Point(8, 38);
this.lbMin.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbMin.Name = "lbMin"; this.lbMin.Name = "lbMin";
this.lbMin.Size = new System.Drawing.Size(95, 20); this.lbMin.Size = new System.Drawing.Size(65, 13);
this.lbMin.TabIndex = 13; this.lbMin.TabIndex = 13;
this.lbMin.Text = "Min bounds:"; this.lbMin.Text = "Min bounds:";
// //
// txtMaxZ // txtMaxZ
// //
this.txtMaxZ.Location = new System.Drawing.Point(272, 95); this.txtMaxZ.Location = new System.Drawing.Point(181, 62);
this.txtMaxZ.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMaxZ.Name = "txtMaxZ"; this.txtMaxZ.Name = "txtMaxZ";
this.txtMaxZ.Size = new System.Drawing.Size(55, 26); this.txtMaxZ.Size = new System.Drawing.Size(38, 20);
this.txtMaxZ.TabIndex = 23; this.txtMaxZ.TabIndex = 23;
this.txtMaxZ.TextChanged += new System.EventHandler(this.txtMaxZ_TextChanged); this.txtMaxZ.TextChanged += new System.EventHandler(this.txtMaxZ_TextChanged);
// //
// txtMaxY // txtMaxY
// //
this.txtMaxY.Location = new System.Drawing.Point(206, 95); this.txtMaxY.Location = new System.Drawing.Point(137, 62);
this.txtMaxY.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMaxY.Name = "txtMaxY"; this.txtMaxY.Name = "txtMaxY";
this.txtMaxY.Size = new System.Drawing.Size(55, 26); this.txtMaxY.Size = new System.Drawing.Size(38, 20);
this.txtMaxY.TabIndex = 22; this.txtMaxY.TabIndex = 22;
this.txtMaxY.TextChanged += new System.EventHandler(this.txtMaxY_TextChanged); this.txtMaxY.TextChanged += new System.EventHandler(this.txtMaxY_TextChanged);
// //
// txtMinX // txtMinX
// //
this.txtMinX.Location = new System.Drawing.Point(140, 54); this.txtMinX.Location = new System.Drawing.Point(93, 35);
this.txtMinX.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMinX.Name = "txtMinX"; this.txtMinX.Name = "txtMinX";
this.txtMinX.Size = new System.Drawing.Size(55, 26); this.txtMinX.Size = new System.Drawing.Size(38, 20);
this.txtMinX.TabIndex = 14; this.txtMinX.TabIndex = 14;
this.txtMinX.TextChanged += new System.EventHandler(this.txtMinX_TextChanged); this.txtMinX.TextChanged += new System.EventHandler(this.txtMinX_TextChanged);
// //
// txtMaxX // txtMaxX
// //
this.txtMaxX.Location = new System.Drawing.Point(140, 95); this.txtMaxX.Location = new System.Drawing.Point(93, 62);
this.txtMaxX.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMaxX.Name = "txtMaxX"; this.txtMaxX.Name = "txtMaxX";
this.txtMaxX.Size = new System.Drawing.Size(55, 26); this.txtMaxX.Size = new System.Drawing.Size(38, 20);
this.txtMaxX.TabIndex = 21; this.txtMaxX.TabIndex = 21;
this.txtMaxX.TextChanged += new System.EventHandler(this.txtMaxX_TextChanged); this.txtMaxX.TextChanged += new System.EventHandler(this.txtMaxX_TextChanged);
// //
// txtMinY // txtMinY
// //
this.txtMinY.Location = new System.Drawing.Point(206, 54); this.txtMinY.Location = new System.Drawing.Point(137, 35);
this.txtMinY.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMinY.Name = "txtMinY"; this.txtMinY.Name = "txtMinY";
this.txtMinY.Size = new System.Drawing.Size(55, 26); this.txtMinY.Size = new System.Drawing.Size(38, 20);
this.txtMinY.TabIndex = 15; this.txtMinY.TabIndex = 15;
this.txtMinY.TextChanged += new System.EventHandler(this.txtMinY_TextChanged); this.txtMinY.TextChanged += new System.EventHandler(this.txtMinY_TextChanged);
// //
// lbMax // lbMax
// //
this.lbMax.AutoSize = true; this.lbMax.AutoSize = true;
this.lbMax.Location = new System.Drawing.Point(12, 100); this.lbMax.Location = new System.Drawing.Point(8, 65);
this.lbMax.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbMax.Name = "lbMax"; this.lbMax.Name = "lbMax";
this.lbMax.Size = new System.Drawing.Size(99, 20); this.lbMax.Size = new System.Drawing.Size(68, 13);
this.lbMax.TabIndex = 20; this.lbMax.TabIndex = 20;
this.lbMax.Text = "Max bounds:"; this.lbMax.Text = "Max bounds:";
// //
// txtMinZ // txtMinZ
// //
this.txtMinZ.Location = new System.Drawing.Point(272, 54); this.txtMinZ.Location = new System.Drawing.Point(181, 35);
this.txtMinZ.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMinZ.Name = "txtMinZ"; this.txtMinZ.Name = "txtMinZ";
this.txtMinZ.Size = new System.Drawing.Size(55, 26); this.txtMinZ.Size = new System.Drawing.Size(38, 20);
this.txtMinZ.TabIndex = 16; this.txtMinZ.TabIndex = 16;
this.txtMinZ.TextChanged += new System.EventHandler(this.txtMinZ_TextChanged); this.txtMinZ.TextChanged += new System.EventHandler(this.txtMinZ_TextChanged);
// //
// lbZ // lbZ
// //
this.lbZ.AutoSize = true; this.lbZ.AutoSize = true;
this.lbZ.Location = new System.Drawing.Point(290, 25); this.lbZ.Location = new System.Drawing.Point(193, 16);
this.lbZ.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbZ.Name = "lbZ"; this.lbZ.Name = "lbZ";
this.lbZ.Size = new System.Drawing.Size(19, 20); this.lbZ.Size = new System.Drawing.Size(14, 13);
this.lbZ.TabIndex = 19; this.lbZ.TabIndex = 19;
this.lbZ.Text = "Z"; this.lbZ.Text = "Z";
// //
// lbY // lbY
// //
this.lbY.AutoSize = true; this.lbY.AutoSize = true;
this.lbY.Location = new System.Drawing.Point(225, 25); this.lbY.Location = new System.Drawing.Point(150, 16);
this.lbY.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbY.Name = "lbY"; this.lbY.Name = "lbY";
this.lbY.Size = new System.Drawing.Size(20, 20); this.lbY.Size = new System.Drawing.Size(14, 13);
this.lbY.TabIndex = 18; this.lbY.TabIndex = 18;
this.lbY.Text = "Y"; this.lbY.Text = "Y";
// //
// lbX // lbX
// //
this.lbX.AutoSize = true; this.lbX.AutoSize = true;
this.lbX.Location = new System.Drawing.Point(159, 25); this.lbX.Location = new System.Drawing.Point(106, 16);
this.lbX.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbX.Name = "lbX"; this.lbX.Name = "lbX";
this.lbX.Size = new System.Drawing.Size(20, 20); this.lbX.Size = new System.Drawing.Size(14, 13);
this.lbX.TabIndex = 17; this.lbX.TabIndex = 17;
this.lbX.Text = "X"; this.lbX.Text = "X";
// //
@@ -496,31 +571,27 @@
this.grFiltering.Controls.Add(this.lbFilterNeighbors); this.grFiltering.Controls.Add(this.lbFilterNeighbors);
this.grFiltering.Controls.Add(this.lbFilterDistance); this.grFiltering.Controls.Add(this.lbFilterDistance);
this.grFiltering.Controls.Add(this.txtFilterDistance); this.grFiltering.Controls.Add(this.txtFilterDistance);
this.grFiltering.Location = new System.Drawing.Point(14, 178); this.grFiltering.Location = new System.Drawing.Point(9, 116);
this.grFiltering.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grFiltering.Name = "grFiltering"; this.grFiltering.Name = "grFiltering";
this.grFiltering.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); this.grFiltering.Size = new System.Drawing.Size(249, 88);
this.grFiltering.Size = new System.Drawing.Size(374, 135);
this.grFiltering.TabIndex = 45; this.grFiltering.TabIndex = 45;
this.grFiltering.TabStop = false; this.grFiltering.TabStop = false;
this.grFiltering.Text = "Filtering"; this.grFiltering.Text = "Filtering";
// //
// txtFilterNeighbors // txtFilterNeighbors
// //
this.txtFilterNeighbors.Location = new System.Drawing.Point(140, 60); this.txtFilterNeighbors.Location = new System.Drawing.Point(93, 39);
this.txtFilterNeighbors.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtFilterNeighbors.Name = "txtFilterNeighbors"; this.txtFilterNeighbors.Name = "txtFilterNeighbors";
this.txtFilterNeighbors.Size = new System.Drawing.Size(55, 26); this.txtFilterNeighbors.Size = new System.Drawing.Size(38, 20);
this.txtFilterNeighbors.TabIndex = 20; this.txtFilterNeighbors.TabIndex = 20;
this.txtFilterNeighbors.TextChanged += new System.EventHandler(this.txtFilterNeighbors_TextChanged); this.txtFilterNeighbors.TextChanged += new System.EventHandler(this.txtFilterNeighbors_TextChanged);
// //
// chFilter // chFilter
// //
this.chFilter.AutoSize = true; this.chFilter.AutoSize = true;
this.chFilter.Location = new System.Drawing.Point(140, 25); this.chFilter.Location = new System.Drawing.Point(93, 16);
this.chFilter.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.chFilter.Name = "chFilter"; this.chFilter.Name = "chFilter";
this.chFilter.Size = new System.Drawing.Size(147, 24); this.chFilter.Size = new System.Drawing.Size(100, 17);
this.chFilter.TabIndex = 18; this.chFilter.TabIndex = 18;
this.chFilter.Text = "filtering enabled"; this.chFilter.Text = "filtering enabled";
this.chFilter.UseVisualStyleBackColor = true; this.chFilter.UseVisualStyleBackColor = true;
@@ -529,29 +600,26 @@
// lbFilterNeighbors // lbFilterNeighbors
// //
this.lbFilterNeighbors.AutoSize = true; this.lbFilterNeighbors.AutoSize = true;
this.lbFilterNeighbors.Location = new System.Drawing.Point(12, 65); this.lbFilterNeighbors.Location = new System.Drawing.Point(8, 42);
this.lbFilterNeighbors.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbFilterNeighbors.Name = "lbFilterNeighbors"; this.lbFilterNeighbors.Name = "lbFilterNeighbors";
this.lbFilterNeighbors.Size = new System.Drawing.Size(98, 20); this.lbFilterNeighbors.Size = new System.Drawing.Size(67, 13);
this.lbFilterNeighbors.TabIndex = 19; this.lbFilterNeighbors.TabIndex = 19;
this.lbFilterNeighbors.Text = "N neighbors:"; this.lbFilterNeighbors.Text = "N neighbors:";
// //
// lbFilterDistance // lbFilterDistance
// //
this.lbFilterDistance.AutoSize = true; this.lbFilterDistance.AutoSize = true;
this.lbFilterDistance.Location = new System.Drawing.Point(12, 105); this.lbFilterDistance.Location = new System.Drawing.Point(8, 68);
this.lbFilterDistance.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbFilterDistance.Name = "lbFilterDistance"; this.lbFilterDistance.Name = "lbFilterDistance";
this.lbFilterDistance.Size = new System.Drawing.Size(106, 20); this.lbFilterDistance.Size = new System.Drawing.Size(73, 13);
this.lbFilterDistance.TabIndex = 21; this.lbFilterDistance.TabIndex = 21;
this.lbFilterDistance.Text = "Max distance:"; this.lbFilterDistance.Text = "Max distance:";
// //
// txtFilterDistance // txtFilterDistance
// //
this.txtFilterDistance.Location = new System.Drawing.Point(140, 100); this.txtFilterDistance.Location = new System.Drawing.Point(93, 65);
this.txtFilterDistance.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtFilterDistance.Name = "txtFilterDistance"; this.txtFilterDistance.Name = "txtFilterDistance";
this.txtFilterDistance.Size = new System.Drawing.Size(55, 26); this.txtFilterDistance.Size = new System.Drawing.Size(38, 20);
this.txtFilterDistance.TabIndex = 22; this.txtFilterDistance.TabIndex = 22;
this.txtFilterDistance.TextChanged += new System.EventHandler(this.txtFilterDistance_TextChanged); this.txtFilterDistance.TextChanged += new System.EventHandler(this.txtFilterDistance_TextChanged);
// //
@@ -568,79 +636,13 @@
this.grServer.Controls.Add(this.txtICPIters); this.grServer.Controls.Add(this.txtICPIters);
this.grServer.Controls.Add(this.chMerge); this.grServer.Controls.Add(this.chMerge);
this.grServer.Controls.Add(this.lbICPIters); this.grServer.Controls.Add(this.lbICPIters);
this.grServer.Location = new System.Drawing.Point(18, 478); this.grServer.Location = new System.Drawing.Point(12, 426);
this.grServer.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grServer.Name = "grServer"; this.grServer.Name = "grServer";
this.grServer.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); this.grServer.Size = new System.Drawing.Size(632, 114);
this.grServer.Size = new System.Drawing.Size(948, 175);
this.grServer.TabIndex = 44; this.grServer.TabIndex = 44;
this.grServer.TabStop = false; this.grServer.TabStop = false;
this.grServer.Text = "KinectServer settings"; this.grServer.Text = "KinectServer settings";
// //
// rBinaryPly
//
this.rBinaryPly.AutoSize = true;
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(110, 24);
this.rBinaryPly.TabIndex = 30;
this.rBinaryPly.TabStop = true;
this.rBinaryPly.Text = "binary PLY";
this.rBinaryPly.UseVisualStyleBackColor = true;
this.rBinaryPly.CheckedChanged += new System.EventHandler(this.PlyFormat_CheckedChanged);
//
// lbFormat
//
this.lbFormat.AutoSize = true;
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(88, 20);
this.lbFormat.TabIndex = 29;
this.lbFormat.Text = "File format:";
//
// rAsciiPly
//
this.rAsciiPly.AutoSize = true;
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(111, 24);
this.rAsciiPly.TabIndex = 28;
this.rAsciiPly.TabStop = true;
this.rAsciiPly.Text = "ASCII PLY";
this.rAsciiPly.UseVisualStyleBackColor = true;
this.rAsciiPly.CheckedChanged += new System.EventHandler(this.PlyFormat_CheckedChanged);
//
// txtRefinIters
//
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(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(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(178, 20);
this.lbOuterIters.TabIndex = 26;
this.lbOuterIters.Text = "Num of refinement iters:";
//
// label2
//
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 // cbCompressionLevel
// //
this.cbCompressionLevel.FormattingEnabled = true; this.cbCompressionLevel.FormattingEnabled = true;
@@ -657,26 +659,91 @@
"15", "15",
"17", "17",
"19"}); "19"});
this.cbCompressionLevel.Location = new System.Drawing.Point(154, 136); this.cbCompressionLevel.Location = new System.Drawing.Point(103, 88);
this.cbCompressionLevel.Margin = new System.Windows.Forms.Padding(2);
this.cbCompressionLevel.Name = "cbCompressionLevel"; this.cbCompressionLevel.Name = "cbCompressionLevel";
this.cbCompressionLevel.Size = new System.Drawing.Size(169, 28); this.cbCompressionLevel.Size = new System.Drawing.Size(114, 21);
this.cbCompressionLevel.TabIndex = 32; this.cbCompressionLevel.TabIndex = 32;
this.cbCompressionLevel.SelectedIndexChanged += new System.EventHandler(this.cbCompressionLevel_SelectedIndexChanged); this.cbCompressionLevel.SelectedIndexChanged += new System.EventHandler(this.cbCompressionLevel_SelectedIndexChanged);
// //
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(5, 90);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(95, 13);
this.label2.TabIndex = 31;
this.label2.Text = "Compression level:";
//
// rBinaryPly
//
this.rBinaryPly.AutoSize = true;
this.rBinaryPly.Location = new System.Drawing.Point(185, 68);
this.rBinaryPly.Name = "rBinaryPly";
this.rBinaryPly.Size = new System.Drawing.Size(76, 17);
this.rBinaryPly.TabIndex = 30;
this.rBinaryPly.TabStop = true;
this.rBinaryPly.Text = "binary PLY";
this.rBinaryPly.UseVisualStyleBackColor = true;
this.rBinaryPly.CheckedChanged += new System.EventHandler(this.PlyFormat_CheckedChanged);
//
// lbFormat
//
this.lbFormat.AutoSize = true;
this.lbFormat.Location = new System.Drawing.Point(5, 69);
this.lbFormat.Name = "lbFormat";
this.lbFormat.Size = new System.Drawing.Size(58, 13);
this.lbFormat.TabIndex = 29;
this.lbFormat.Text = "File format:";
//
// rAsciiPly
//
this.rAsciiPly.AutoSize = true;
this.rAsciiPly.Location = new System.Drawing.Point(104, 68);
this.rAsciiPly.Name = "rAsciiPly";
this.rAsciiPly.Size = new System.Drawing.Size(75, 17);
this.rAsciiPly.TabIndex = 28;
this.rAsciiPly.TabStop = true;
this.rAsciiPly.Text = "ASCII PLY";
this.rAsciiPly.UseVisualStyleBackColor = true;
this.rAsciiPly.CheckedChanged += new System.EventHandler(this.PlyFormat_CheckedChanged);
//
// txtRefinIters
//
this.txtRefinIters.Location = new System.Drawing.Point(272, 20);
this.txtRefinIters.Name = "txtRefinIters";
this.txtRefinIters.Size = new System.Drawing.Size(38, 20);
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(148, 23);
this.lbOuterIters.Name = "lbOuterIters";
this.lbOuterIters.Size = new System.Drawing.Size(118, 13);
this.lbOuterIters.TabIndex = 26;
this.lbOuterIters.Text = "Num of refinement iters:";
//
// SettingsForm // SettingsForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(984, 663); this.ClientSize = new System.Drawing.Size(656, 554);
this.Controls.Add(this.grServer); this.Controls.Add(this.grServer);
this.Controls.Add(this.grClient); this.Controls.Add(this.grClient);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "SettingsForm"; this.Name = "SettingsForm";
this.Text = "Settings"; this.Text = "Settings";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SettingsForm_FormClosed);
this.Load += new System.EventHandler(this.SettingsForm_Load); this.Load += new System.EventHandler(this.SettingsForm_Load);
this.grClient.ResumeLayout(false); this.grClient.ResumeLayout(false);
this.grExposure.ResumeLayout(false);
this.grExposure.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trManualExposure)).EndInit();
this.grTempSync.ResumeLayout(false);
this.grBody.ResumeLayout(false); this.grBody.ResumeLayout(false);
this.grBody.PerformLayout(); this.grBody.PerformLayout();
this.grMarkers.ResumeLayout(false); this.grMarkers.ResumeLayout(false);
@@ -744,6 +811,14 @@
private System.Windows.Forms.CheckBox chSkeletons; private System.Windows.Forms.CheckBox chSkeletons;
private System.Windows.Forms.ComboBox cbCompressionLevel; private System.Windows.Forms.ComboBox cbCompressionLevel;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox grTempSync;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lbTempSync;
private System.Windows.Forms.Button btSyncDisable;
private System.Windows.Forms.Button btSyncEnable;
private System.Windows.Forms.TrackBar trManualExposure;
private System.Windows.Forms.GroupBox grExposure;
private System.Windows.Forms.Label lbManualExposure;
private System.Windows.Forms.CheckBox chAutoExposureEnabled;
} }
} }
+114
View File
@@ -30,6 +30,8 @@ namespace KinectServer
public KinectSettings oSettings; public KinectSettings oSettings;
public KinectServer oServer; public KinectServer oServer;
private Timer scrollTimer = null;
bool bFormLoaded = false; bool bFormLoaded = false;
public SettingsForm() public SettingsForm()
@@ -61,6 +63,14 @@ namespace KinectServer
chMerge.Checked = oSettings.bMergeScansForSave; chMerge.Checked = oSettings.bMergeScansForSave;
txtICPIters.Text = oSettings.nNumICPIterations.ToString(); txtICPIters.Text = oSettings.nNumICPIterations.ToString();
txtRefinIters.Text = oSettings.nNumRefineIters.ToString(); txtRefinIters.Text = oSettings.nNumRefineIters.ToString();
btSyncEnable.Enabled = true;
btSyncDisable.Enabled = false;
chAutoExposureEnabled.Checked = oSettings.bAutoExposureEnabled;
trManualExposure.Value = oSettings.nExposureStep;
if (oSettings.bSaveAsBinaryPLY) if (oSettings.bSaveAsBinaryPLY)
{ {
rBinaryPly.Checked = true; rBinaryPly.Checked = true;
@@ -78,7 +88,10 @@ namespace KinectServer
void UpdateClients() void UpdateClients()
{ {
if (bFormLoaded) if (bFormLoaded)
{
oServer.SendSettings(); oServer.SendSettings();
}
} }
void UpdateMarkerFields() void UpdateMarkerFields()
@@ -340,5 +353,106 @@ namespace KinectServer
} }
UpdateClients(); UpdateClients();
} }
private void btSyncEnable_click(object sender, EventArgs e)
{
if (oServer.GetAllDevicesInitialized() && oServer.nClientCount > 1)
{
oServer.RequestDeviceSyncState();
btSyncEnable.Enabled = false;
btSyncDisable.Enabled = true;
//Disable the Auto Exposure, as this could interfere with the temporal sync
chAutoExposureEnabled.Enabled = false;
trManualExposure.Enabled = true;
chAutoExposureEnabled.CheckState = CheckState.Unchecked;
}
}
private void btSyncDisable_click(object sender, EventArgs e)
{
if (oServer.GetAllDevicesInitialized())
{
oServer.DisableTemporalSync();
btSyncEnable.Enabled = true;
btSyncDisable.Enabled = false;
chAutoExposureEnabled.Enabled = true;
}
}
public void ActivateTempSyncEnableButton()
{
//As a Form code is run on a single UI thread, we need to communicate with that thread via Invoke
this.BeginInvoke(new MethodInvoker(delegate
{
btSyncEnable.Enabled = true;
btSyncDisable.Enabled = false;
chAutoExposureEnabled.Enabled = true;
}));
}
private void chAutoExposureEnabled_CheckedChanged(object sender, EventArgs e)
{
oSettings.bAutoExposureEnabled = chAutoExposureEnabled.Checked;
UpdateClients();
trManualExposure.Enabled = !oSettings.bAutoExposureEnabled;
}
/// <summary>
/// When the user scrolls on the trackbar, we wait a short amount of time to check if the user has scrolled again.
/// This prevents the Manual Exposure to be set too often, and only sets it when the user has stopped scrolling.
/// Code taken from: https://stackoverflow.com/a/15687418
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void trManualExposure_Scroll(object sender, EventArgs e)
{
if (scrollTimer == null)
{
// Will tick every 500ms
scrollTimer = new Timer()
{
Enabled = false,
Interval = 300,
Tag = (sender as TrackBar).Value
};
scrollTimer.Tick += (s, ea) =>
{
// check to see if the value has changed since we last ticked
if (trManualExposure.Value == (int)scrollTimer.Tag)
{
// scrolling has stopped so we are good to go ahead and do stuff
scrollTimer.Stop();
// Send the changed exposure to the devices
//Clamp Exposure Step between -11 and 1
int exposureStep = trManualExposure.Value;
int exposureStepClamped = exposureStep < -11 ? -11 : exposureStep > 1 ? 1 : exposureStep;
oSettings.nExposureStep = exposureStepClamped;
UpdateClients();
scrollTimer.Dispose();
scrollTimer = null;
}
else
{
// record the last value seen
scrollTimer.Tag = trManualExposure.Value;
}
};
scrollTimer.Start();
}
}
private void SettingsForm_FormClosed(object sender, FormClosedEventArgs e)
{
oServer.SetSettingsForm(null);
}
} }
} }
+9
View File
@@ -19,6 +19,15 @@ To start working with our software you will need a Windows machine with the Kine
Both the binary and source distributions contain a manual (in the docs directory) which contains the steps necessary to start working with our software (it won't take more than a couple of minutes to set up). Both the binary and source distributions contain a manual (in the docs directory) which contains the steps necessary to start working with our software (it won't take more than a couple of minutes to set up).
#### Temporal Synchronziaton (Azure Kinect only) ####
LiveScan3D supports the synchronization feature of the Azure Kinect, which will temporally sync multiple devices to allow for a cleaner capture.
To enable it, connect all devices via cable in a Daisy-chain configuration [(more information here)](https://docs.microsoft.com/en-us/azure/kinect-dk/multi-camera-sync/). Open the settings in the LiveScan server and click the "Enable"-Button found under "Temporal Sync". The devices will now perform a restart and after a few seconds you should be able to see the role of the devices (Master, Subordinate, Slave) in the Client-List of the Server. A error message will appear if the devices are not connected properly, or experience other difficulties.
*Note: While the Sync feature is activated, the camera exposure has to be controlled manually.*
#### Exposure Control (Azure Kinect only) ####
Livescan supports exposure control for all clients. LiveScan uses auto exposure as a default setting. To enable or disable manual exposure, open the settings on the LiveScan server and tick the "Auto exposure enabled" box. If auto exposure is disabled, you can manually set the exposure with the slider provided below the box.
## Where to get help ## ## Where to get help ##
If you have any problems feel free to contact us: Marek Kowalski <m.kowalski@ire.pw.edu.pl>, Jacek Naruniec <j.naruniec@ire.pw.edu.pl>. We usually answer emails quickly (our timezone is CET). If you have any problems feel free to contact us: Marek Kowalski <m.kowalski@ire.pw.edu.pl>, Jacek Naruniec <j.naruniec@ire.pw.edu.pl>. We usually answer emails quickly (our timezone is CET).
Binary file not shown.
@@ -0,0 +1,56 @@
#pragma once
#include "stdafx.h"
#include "ICapture.h"
#include <k4a/k4a.h>
#include <opencv2/opencv.hpp>
#include "utils.h"
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
class AzureKinectCapture : public ICapture
{
public:
AzureKinectCapture();
~AzureKinectCapture();
bool Initialize(SYNC_STATE state, int syncOffset);
bool AcquireFrame();
bool Close();
void MapDepthFrameToCameraSpace(Point3f *pCameraSpacePoints);
void MapColorFrameToCameraSpace(Point3f *pCameraSpacePoints);
void MapDepthFrameToColorSpace(UINT16 *pDepthInColorSpace);
void MapColorFrameToDepthSpace(RGB *pColorInDepthSpace);
int GetSyncJackState();
uint64_t GetTimeStamp();
int GetDeviceIndex();
void SetExposureState(bool enableAutoExposure, int exposureStep);
private:
k4a_device_t kinectSensor = NULL;
int32_t captureTimeoutMs = 1000;
k4a_image_t colorImage = NULL;
k4a_image_t depthImage = NULL;
k4a_image_t pointCloudImage = NULL;
k4a_image_t transformedDepthImage = NULL;
k4a_image_t colorImageInDepth = NULL;
k4a_image_t depthImageInColor = NULL;
k4a_image_t colorImageDownscaled = NULL;
k4a_transformation_t transformationColorDownscaled = NULL;
k4a_transformation_t transformation = NULL;
int colorImageDownscaledWidth;
int colorImageDownscaledHeight;
bool syncInConnected = false;
bool syncOutConnected = false;
uint64_t currentTimeStamp = 0;
SYNC_STATE syncState = Standalone;
int deviceIDForRestart = -1;
int restartAttempts = 0;
bool autoExposureEnabled = true;
int exposureTimeStep = 0;
void UpdateDepthPointCloud();
void UpdateDepthPointCloudForColorFrame();
};
+2 -2
View File
@@ -42,8 +42,8 @@ public:
~Calibration(); ~Calibration();
bool Calibrate(RGB *pBuffer, Point3f *pCameraCoordinates, int cColorWidth, int cColorHeight); bool Calibrate(RGB *pBuffer, Point3f *pCameraCoordinates, int cColorWidth, int cColorHeight);
bool LoadCalibration(); bool LoadCalibration(const string &serialNumber);
void SaveCalibration(); void SaveCalibration(const string &serialNumber);
private: private:
IMarker *pDetector; IMarker *pDetector;
int nSampleCounter; int nSampleCounter;
@@ -10,13 +10,13 @@ class FrameFileWriterReader
{ {
public: public:
FrameFileWriterReader(); FrameFileWriterReader();
void openNewFileForWriting(); void openNewFileForWriting(int deviceID);
void openCurrentFileForReading(); void openCurrentFileForReading();
// leave filename blank if you want the filename to be generated from the date // leave filename blank if you want the filename to be generated from the date
void setCurrentFilename(std::string filename = ""); void setCurrentFilename(std::string filename = "");
void writeFrame(std::vector<Point3s> points, std::vector<RGB> colors); void writeFrame(std::vector<Point3s> points, std::vector<RGB> colors, uint64_t timestamp, int deviceID);
bool readFrame(std::vector<Point3s> &outPoints, std::vector<RGB> &outColors); bool readFrame(std::vector<Point3s> &outPoints, std::vector<RGB> &outColors);
bool openedForWriting() { return m_bFileOpenedForWriting; } bool openedForWriting() { return m_bFileOpenedForWriting; }
+20 -6
View File
@@ -15,15 +15,19 @@
#pragma once #pragma once
#include "utils.h" #include "utils.h"
#include "Kinect.h"
struct Joint
{
};
struct Body struct Body
{ {
Body() Body()
{ {
bTracked = false; bTracked = false;
vJoints.resize(JointType_Count); vJoints.resize(5);
vJointsInColorSpace.resize(JointType_Count); vJointsInColorSpace.resize(5);
} }
bool bTracked; bool bTracked;
std::vector<Joint> vJoints; std::vector<Joint> vJoints;
@@ -36,12 +40,18 @@ public:
ICapture(); ICapture();
~ICapture(); ~ICapture();
virtual bool Initialize() = 0; virtual bool Initialize(SYNC_STATE state, int syncOffset) = 0;
virtual bool AcquireFrame() = 0; virtual bool AcquireFrame() = 0;
virtual bool Close() = 0;
virtual void MapDepthFrameToCameraSpace(Point3f *pCameraSpacePoints) = 0; virtual void MapDepthFrameToCameraSpace(Point3f *pCameraSpacePoints) = 0;
virtual void MapColorFrameToCameraSpace(Point3f *pCameraSpacePoints) = 0; virtual void MapColorFrameToCameraSpace(Point3f *pCameraSpacePoints) = 0;
virtual void MapDepthFrameToColorSpace(Point2f *pColorSpacePoints) = 0; virtual void MapDepthFrameToColorSpace(UINT16 *pColorSpacePoints) = 0;
virtual void MapColorFrameToDepthSpace(Point2f *pDepthSpacePoints) = 0; virtual void MapColorFrameToDepthSpace(RGB *pDepthSpacePoints) = 0;
virtual int GetSyncJackState() = 0;
virtual uint64_t GetTimeStamp() = 0;
virtual int GetDeviceIndex() = 0;
virtual void SetExposureState(bool enableAutoExposure, int exposureStep) = 0;
bool bInitialized; bool bInitialized;
@@ -52,4 +62,8 @@ public:
BYTE *pBodyIndex; BYTE *pBodyIndex;
RGB *pColorRGBX; RGB *pColorRGBX;
std::vector<Body> vBodies; std::vector<Body> vBodies;
std::string serialNumber;
}; };
+2 -2
View File
@@ -68,8 +68,8 @@ private:
/// </summary> /// </summary>
void DiscardResources(); void DiscardResources();
void DrawBody(Body &body); //void DrawBody(Body &body);
void DrawBone(Body &body, JointType joint0, JointType joint1); //void DrawBone(Body &body, JointType joint0, JointType joint1);
ID2D1SolidColorBrush* m_pBrushJointTracked; ID2D1SolidColorBrush* m_pBrushJointTracked;
ID2D1SolidColorBrush* m_pBrushJointInferred; ID2D1SolidColorBrush* m_pBrushJointInferred;
-43
View File
@@ -1,43 +0,0 @@
// Copyright (C) 2015 Marek Kowalski (M.Kowalski@ire.pw.edu.pl), Jacek Naruniec (J.Naruniec@ire.pw.edu.pl)
// License: MIT Software License See LICENSE.txt for the full license.
// If you use this software in your research, then please use the following citation:
// Kowalski, M.; Naruniec, J.; Daniluk, M.: "LiveScan3D: A Fast and Inexpensive 3D Data
// Acquisition System for Multiple Kinect v2 Sensors". in 3D Vision (3DV), 2015 International Conference on, Lyon, France, 2015
// @INPROCEEDINGS{Kowalski15,
// author={Kowalski, M. and Naruniec, J. and Daniluk, M.},
// booktitle={3D Vision (3DV), 2015 International Conference on},
// title={LiveScan3D: A Fast and Inexpensive 3D Data Acquisition System for Multiple Kinect v2 Sensors},
// year={2015},
// }
#pragma once
#include "stdafx.h"
#include "ICapture.h"
#include "Kinect.h"
#include "utils.h"
class KinectCapture : public ICapture
{
public:
KinectCapture();
~KinectCapture();
bool Initialize();
bool AcquireFrame();
void MapDepthFrameToCameraSpace(Point3f *pCameraSpacePoints);
void MapColorFrameToCameraSpace(Point3f *pCameraSpacePoints);
void MapDepthFrameToColorSpace(Point2f *pColorSpacePoints);
void MapColorFrameToDepthSpace(Point2f *pDepthSpacePoints);
private:
ICoordinateMapper* pCoordinateMapper;
IKinectSensor* pKinectSensor;
IMultiSourceFrameReader* pMultiSourceFrameReader;
void GetDepthFrame(IMultiSourceFrame* pMultiFrame);
void GetColorFrame(IMultiSourceFrame* pMultiFrame);
void GetBodyFrame(IMultiSourceFrame* pMultiFrame);
void GetBodyIndexFrame(IMultiSourceFrame* pMultiFrame);
};
+20 -7
View File
@@ -18,8 +18,8 @@
#include "ImageRenderer.h" #include "ImageRenderer.h"
#include "SocketCS.h" #include "SocketCS.h"
#include "calibration.h" #include "calibration.h"
#include "utils.h" //#include "utils.h"
#include "KinectCapture.h" #include "azureKinectCapture.h"
#include "frameFileWriterReader.h" #include "frameFileWriterReader.h"
#include <thread> #include <thread>
#include <mutex> #include <mutex>
@@ -43,6 +43,10 @@ private:
bool m_bFilter; bool m_bFilter;
bool m_bStreamOnlyBodies; bool m_bStreamOnlyBodies;
bool m_bIsMaster;
bool m_bIsSubOrdinate;
bool m_bRestartingCamera;
ICapture *pCapture; ICapture *pCapture;
int m_nFilterNeighbors; int m_nFilterNeighbors;
@@ -51,10 +55,18 @@ private:
bool m_bCaptureFrame; bool m_bCaptureFrame;
bool m_bConnected; bool m_bConnected;
bool m_bConfirmCaptured; bool m_bConfirmCaptured;
bool m_bConfirmTempSyncState;
bool m_bConfirmSubOrdinateStarted;
bool m_bConfirmRestartAsMaster;
bool m_bConfirmCalibrated; bool m_bConfirmCalibrated;
bool m_bShowDepth; bool m_bShowDepth;
bool m_bFrameCompression; bool m_bFrameCompression;
int m_iCompressionLevel; int m_iCompressionLevel;
bool m_bAutoExposureEnabled;
int m_nExposureStep;
enum tempSyncConfig { MASTER, SUBORDINATE, STANDALONE };
tempSyncConfig currentTempSyncState;
FrameFileWriterReader m_framesFileWriterReader; FrameFileWriterReader m_framesFileWriterReader;
@@ -71,10 +83,11 @@ private:
double m_fFreq; double m_fFreq;
INT64 m_nNextStatusTime; INT64 m_nNextStatusTime;
DWORD m_nFramesSinceUpdate; DWORD m_nFramesSinceUpdate;
int frameRecordCounter;
Point3f* m_pCameraSpaceCoordinates; Point3f* m_pCameraSpaceCoordinates;
Point2f* m_pColorCoordinatesOfDepth; RGB* m_pColorInColorSpace;
Point2f* m_pDepthCoordinatesOfColor; UINT16* m_pDepthInColorSpace;
// Direct2D // Direct2D
ImageRenderer* m_pDrawColor; ImageRenderer* m_pDrawColor;
@@ -82,8 +95,8 @@ private:
RGB* m_pDepthRGBX; RGB* m_pDepthRGBX;
void UpdateFrame(); void UpdateFrame();
void ProcessColor(RGB* pBuffer, int nWidth, int nHeight); void ShowColor();
void ProcessDepth(const UINT16* pBuffer, int nHeight, int nWidth); void ShowDepth();
bool SetStatusMessage(_In_z_ WCHAR* szMessage, DWORD nShowTimeMsec, bool bForce); bool SetStatusMessage(_In_z_ WCHAR* szMessage, DWORD nShowTimeMsec, bool bForce);
@@ -91,7 +104,7 @@ private:
void SendFrame(vector<Point3s> vertices, vector<RGB> RGB, vector<Body> body); void SendFrame(vector<Point3s> vertices, vector<RGB> RGB, vector<Body> body);
void SocketThreadFunction(); void SocketThreadFunction();
void StoreFrame(Point3f *vertices, Point2f *mapping, RGB *color, vector<Body> &bodies, BYTE* bodyIndex); void StoreFrame(Point3f *vertices, RGB *colorInDepth, vector<Body> &bodies, BYTE* bodyIndex);
void ShowFPS(); void ShowFPS();
void ReadIPFromFile(); void ReadIPFromFile();
void WriteIPToFile(); void WriteIPToFile();
+26 -2
View File
@@ -27,7 +27,11 @@ enum INCOMING_MESSAGE_TYPE
MSG_REQUEST_STORED_FRAME, MSG_REQUEST_STORED_FRAME,
MSG_REQUEST_LAST_FRAME, MSG_REQUEST_LAST_FRAME,
MSG_RECEIVE_CALIBRATION, MSG_RECEIVE_CALIBRATION,
MSG_CLEAR_STORED_FRAMES MSG_CLEAR_STORED_FRAMES,
MSG_SET_TEMPSYNC_ON,
MSG_SET_TEMPSYNC_OFF,
MSG_START_MASTER,
MSG_REQUEST_SYNC_JACK_STATE,
}; };
enum OUTGOING_MESSAGE_TYPE enum OUTGOING_MESSAGE_TYPE
@@ -35,7 +39,17 @@ enum OUTGOING_MESSAGE_TYPE
MSG_CONFIRM_CAPTURED, MSG_CONFIRM_CAPTURED,
MSG_CONFIRM_CALIBRATED, MSG_CONFIRM_CALIBRATED,
MSG_STORED_FRAME, MSG_STORED_FRAME,
MSG_LAST_FRAME MSG_LAST_FRAME,
MSG_CONFIRM_TEMP_SYNC_STATUS,
MSG_CONFIRM_MASTER_RESTART,
MSG_SYNC_JACK_STATE
};
enum SYNC_STATE
{
Subordinate,
Master,
Standalone
}; };
typedef struct Point3f typedef struct Point3f
@@ -45,16 +59,26 @@ typedef struct Point3f
this->X = 0; this->X = 0;
this->Y = 0; this->Y = 0;
this->Z = 0; this->Z = 0;
this->Invalid = false;
}
Point3f(float X, float Y, float Z, bool invalid)
{
this->X = X;
this->Y = Y;
this->Z = Z;
this->Invalid = invalid;
} }
Point3f(float X, float Y, float Z) Point3f(float X, float Y, float Z)
{ {
this->X = X; this->X = X;
this->Y = Y; this->Y = Y;
this->Z = Z; this->Z = Z;
this->Invalid = false;
} }
float X; float X;
float Y; float Y;
float Z; float Z;
bool Invalid = false;
} Point3f; } Point3f;
typedef struct Point3s typedef struct Point3s
+459
View File
@@ -0,0 +1,459 @@
#include "azureKinectCapture.h"
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/opencv.hpp>
#include <chrono>
AzureKinectCapture::AzureKinectCapture()
{
}
AzureKinectCapture::~AzureKinectCapture()
{
k4a_image_release(colorImage);
k4a_image_release(depthImage);
k4a_image_release(pointCloudImage);
k4a_image_release(colorImageInDepth);
k4a_image_release(depthImageInColor);
k4a_image_release(transformedDepthImage);
k4a_image_release(colorImageDownscaled);
k4a_transformation_destroy(transformation);
k4a_device_close(kinectSensor);
}
/// <summary>
/// Initialize the device. If you want to initialize it as Standalone, set "asMaster" and "asSubordinate" to false
/// </summary>
/// <param name="asMaster">Initializes this device as master</param>
/// <param name="asSubordinate">Initalizes this devices as subordinate</param>
/// <param name="syncOffsetMultiplier">Should only be set when initializing as Subordinate. Each subordinate should have a unique, ascending value</param>
/// <returns></returns>
bool AzureKinectCapture::Initialize(SYNC_STATE state, int syncOffsetMultiplier)
{
uint32_t count = k4a_device_get_installed_count();
int deviceIdx = 0;
//We save the deviceId of this Client.
//When the cameras are reinitialized during runtime, we can then gurantee
//that each LiveScan instance uses the same device as before (In case two or more Kinects are connected to the same PC)
//A device ID of -1 means that no Kinects has been successfully initalized yet (only happens when the Client starts)
if (deviceIDForRestart != -1) {
deviceIdx = deviceIDForRestart;
}
kinectSensor = NULL;
while (K4A_FAILED(k4a_device_open(deviceIdx, &kinectSensor)))
{
if (deviceIDForRestart == -1)
{
deviceIdx++;
if (deviceIdx >= count)
{
bInitialized = false;
return bInitialized;
}
}
else {
//Sometimes the cameras fail to reinitialize, so we try to initialize them three times with a slight delay before failing
if (restartAttempts > 2)
{
bInitialized = false;
return bInitialized;
}
else {
restartAttempts++;
Sleep(200);
}
}
}
k4a_device_configuration_t config = K4A_DEVICE_CONFIG_INIT_DISABLE_ALL;
config.camera_fps = K4A_FRAMES_PER_SECOND_30;
config.color_format = K4A_IMAGE_FORMAT_COLOR_BGRA32;
config.color_resolution = K4A_COLOR_RESOLUTION_720P;
config.depth_mode = K4A_DEPTH_MODE_NFOV_UNBINNED;
config.synchronized_images_only = true;
if (state == Master)
{
config.wired_sync_mode = K4A_WIRED_SYNC_MODE_MASTER;
}
else if (state == Subordinate)
{
config.wired_sync_mode = K4A_WIRED_SYNC_MODE_SUBORDINATE;
//Sets the offset on subordinate devices. Should be a multiple of 160, each subordinate having a different multiplier in ascending order.
//This is very important, as it avoids firing the Kinects lasers at the same time.
config.subordinate_delay_off_master_usec = 160 * syncOffsetMultiplier;
}
else
{
config.wired_sync_mode = K4A_WIRED_SYNC_MODE_STANDALONE;
}
// Start the camera with the given configuration
bInitialized = K4A_SUCCEEDED(k4a_device_start_cameras(kinectSensor, &config));
k4a_calibration_t calibration;
if (K4A_FAILED(k4a_device_get_calibration(kinectSensor, config.depth_mode, config.color_resolution, &calibration)))
{
bInitialized = false;
return bInitialized;
}
//Workaround for a bug. When the camera starts in manual Exposure mode, the brightness of the RBG image
//is much lower than in auto exposure mode. To prevent this, we first set the camera to auto exposure mode and
//then switch to manual mode again if it has been enabled before
if (autoExposureEnabled == false) {
k4a_device_set_color_control(kinectSensor, K4A_COLOR_CONTROL_EXPOSURE_TIME_ABSOLUTE, K4A_COLOR_CONTROL_MODE_AUTO, 0);
//Give it a second to adjust
Sleep(1000);
SetExposureState(false, exposureTimeStep);
}
transformation = k4a_transformation_create(&calibration);
//No way to get the depth pixel values from the SDK at the moment, so this is hardcoded
int depth_camera_width;
int depth_camera_height;
switch (config.depth_mode)
{
case K4A_DEPTH_MODE_NFOV_UNBINNED:
depth_camera_width = 640;
depth_camera_height = 576;
break;
case K4A_DEPTH_MODE_NFOV_2X2BINNED:
depth_camera_width = 320;
depth_camera_height = 288;
break;
case K4A_DEPTH_MODE_WFOV_UNBINNED:
depth_camera_width = 1024;
depth_camera_height = 1024;
case K4A_DEPTH_MODE_WFOV_2X2BINNED:
depth_camera_width = 512;
depth_camera_height = 512;
break;
default:
break;
}
//It's crucial for this program to output accurately mapped Pointclouds. The highest accuracy mapping is achieved
//by using the k4a_transformation_depth_image_to_color_camera function. However this converts a small depth image
//to a larger size, equivalent to the the color image size. This means more points to process and higher processing costs
//We can however scale the color image to the depth images size beforehand, to reduce proccesing power.
//We calculate the minimum size that the color Image can be, while preserving its aspect ration
float rescaleRatio = (float)calibration.color_camera_calibration.resolution_height / (float)depth_camera_height;
colorImageDownscaledHeight = depth_camera_height;
colorImageDownscaledWidth = calibration.color_camera_calibration.resolution_width / rescaleRatio;
//We don't only need the size in pixels of the downscaled color image, but also a new k4a_calibration_t which fits the new
//sizes
k4a_calibration_t calibrationColorDownscaled;
memcpy(&calibrationColorDownscaled, &calibration, sizeof(k4a_calibration_t));
calibrationColorDownscaled.color_camera_calibration.resolution_width /= rescaleRatio;
calibrationColorDownscaled.color_camera_calibration.resolution_height /= rescaleRatio;
calibrationColorDownscaled.color_camera_calibration.intrinsics.parameters.param.cx /= rescaleRatio;
calibrationColorDownscaled.color_camera_calibration.intrinsics.parameters.param.cy /= rescaleRatio;
calibrationColorDownscaled.color_camera_calibration.intrinsics.parameters.param.fx /= rescaleRatio;
calibrationColorDownscaled.color_camera_calibration.intrinsics.parameters.param.fy /= rescaleRatio;
transformationColorDownscaled = k4a_transformation_create(&calibrationColorDownscaled);
//If this device is a subordinate, it is expected to start capturing at a later time (When the master has started), so we skip this check
if (state != Subordinate)
{
std::chrono::time_point<std::chrono::system_clock> start = std::chrono::system_clock::now();
bool bTemp;
do
{
bTemp = AcquireFrame();
std::chrono::duration<double> elapsedSeconds = std::chrono::system_clock::now() - start;
if (elapsedSeconds.count() > 5.0)
{
bInitialized = false;
break;
}
} while (!bTemp);
}
size_t serialNoSize;
k4a_device_get_serialnum(kinectSensor, NULL, &serialNoSize);
serialNumber = std::string(serialNoSize, '\0');
k4a_device_get_serialnum(kinectSensor, (char*)serialNumber.c_str(), &serialNoSize);
deviceIDForRestart = deviceIdx;
restartAttempts = 0;
return bInitialized;
}
bool AzureKinectCapture::Close()
{
if (!bInitialized)
{
return false;
}
k4a_device_stop_cameras(kinectSensor);
k4a_device_close(kinectSensor);
bInitialized = false;
return true;
}
bool AzureKinectCapture::AcquireFrame()
{
if (!bInitialized)
{
return false;
}
k4a_capture_t capture = NULL;
k4a_wait_result_t captureResult = k4a_device_get_capture(kinectSensor, &capture, captureTimeoutMs);
if (captureResult != K4A_WAIT_RESULT_SUCCEEDED)
{
k4a_capture_release(capture);
return false;
}
k4a_image_release(colorImage);
k4a_image_release(colorImageDownscaled);
k4a_image_release(depthImage);
colorImage = k4a_capture_get_color_image(capture);
depthImage = k4a_capture_get_depth_image(capture);
currentTimeStamp = k4a_image_get_device_timestamp_usec(colorImage);
if (colorImage == NULL || depthImage == NULL)
{
k4a_capture_release(capture);
return false;
}
//We need to resize the color image, so that it's height fits the depth camera height, while preserving the aspect ratio of the color camera:
//Convert the k4a_image to an OpenCV Mat
cv::Mat cImg = cv::Mat(k4a_image_get_height_pixels(colorImage), k4a_image_get_width_pixels(colorImage), CV_8UC4, k4a_image_get_buffer(colorImage));
//Resize the k4a_image to the precalculated size. Takes quite along time, maybe there is a faster algorithm?
cv::resize(cImg, cImg, cv::Size(colorImageDownscaledWidth, colorImageDownscaledHeight), cv::INTER_LINEAR);
//Create a k4a_image from the resized OpenCV Mat. Code taken from here: https://github.com/microsoft/Azure-Kinect-Sensor-SDK/issues/978#issuecomment-566002061
k4a_image_create(K4A_IMAGE_FORMAT_COLOR_BGRA32, cImg.cols, cImg.rows, cImg.cols * 4 * (int)sizeof(uint8_t), &colorImageDownscaled);
memcpy(k4a_image_get_buffer(colorImageDownscaled), &cImg.ptr<cv::Vec4b>(0)[0], cImg.rows * cImg.cols * sizeof(cv::Vec4b));
if (pColorRGBX == NULL)
{
nColorFrameHeight = k4a_image_get_height_pixels(colorImageDownscaled);
nColorFrameWidth = k4a_image_get_width_pixels(colorImageDownscaled);
pColorRGBX = new RGB[nColorFrameWidth * nColorFrameHeight];
}
if (pDepth == NULL)
{
nDepthFrameHeight = k4a_image_get_height_pixels(depthImage);
nDepthFrameWidth = k4a_image_get_width_pixels(depthImage);
pDepth = new UINT16[nDepthFrameHeight * nDepthFrameWidth];
}
memcpy(pColorRGBX, k4a_image_get_buffer(colorImageDownscaled), nColorFrameWidth * nColorFrameHeight * sizeof(RGB));
memcpy(pDepth, k4a_image_get_buffer(depthImage), nDepthFrameHeight * nDepthFrameWidth * sizeof(UINT16));
k4a_capture_release(capture);
return true;
}
void AzureKinectCapture::UpdateDepthPointCloudForColorFrame()
{
if (transformedDepthImage == NULL)
{
k4a_image_create(K4A_IMAGE_FORMAT_DEPTH16, nColorFrameWidth, nColorFrameHeight, nColorFrameWidth * (int)sizeof(uint16_t), &transformedDepthImage);
}
if (pointCloudImage == NULL)
{
k4a_image_create(K4A_IMAGE_FORMAT_CUSTOM, nColorFrameWidth, nColorFrameHeight, nColorFrameWidth * 3 * (int)sizeof(int16_t), &pointCloudImage);
}
k4a_transformation_depth_image_to_color_camera(transformationColorDownscaled, depthImage, transformedDepthImage);
k4a_transformation_depth_image_to_point_cloud(transformationColorDownscaled, transformedDepthImage, K4A_CALIBRATION_TYPE_COLOR, pointCloudImage);
}
void AzureKinectCapture::UpdateDepthPointCloud()
{
if (pointCloudImage == NULL)
{
k4a_image_create(K4A_IMAGE_FORMAT_CUSTOM16, nDepthFrameWidth, nDepthFrameHeight,
nDepthFrameWidth * 3 * (int)sizeof(int16_t),
&pointCloudImage);
}
k4a_transformation_depth_image_to_point_cloud(transformation, depthImage, K4A_CALIBRATION_TYPE_DEPTH, pointCloudImage);
}
void AzureKinectCapture::MapDepthFrameToCameraSpace(Point3f *pCameraSpacePoints)
{
UpdateDepthPointCloud();
int16_t* pointCloudData = (int16_t*)k4a_image_get_buffer(pointCloudImage);
for (int i = 0; i < nDepthFrameHeight; i++)
{
for (int j = 0; j < nDepthFrameWidth; j++)
{
pCameraSpacePoints[j + i * nDepthFrameWidth].X = pointCloudData[3 * (j + i * nDepthFrameWidth) + 0] / 1000.0f;
pCameraSpacePoints[j + i * nDepthFrameWidth].Y = pointCloudData[3 * (j + i * nDepthFrameWidth) + 1] / 1000.0f;
pCameraSpacePoints[j + i * nDepthFrameWidth].Z = pointCloudData[3 * (j + i * nDepthFrameWidth) + 2] / 1000.0f;
}
}
}
void AzureKinectCapture::MapColorFrameToCameraSpace(Point3f* pCameraSpacePoints)
{
UpdateDepthPointCloudForColorFrame();
int16_t* pointCloudData = (int16_t*)k4a_image_get_buffer(pointCloudImage);
for (int i = 0; i < nColorFrameHeight; i++)
{
for (int j = 0; j < nColorFrameWidth; j++)
{
pCameraSpacePoints[j + i * nColorFrameWidth].X = pointCloudData[3 * (j + i * nColorFrameWidth) + 0] / 1000.0f;
pCameraSpacePoints[j + i * nColorFrameWidth].Y = pointCloudData[3 * (j + i * nColorFrameWidth) + 1] / 1000.0f;
pCameraSpacePoints[j + i * nColorFrameWidth].Z = pointCloudData[3 * (j + i * nColorFrameWidth) + 2] / 1000.0f;
}
}
}
void AzureKinectCapture::MapDepthFrameToColorSpace(UINT16 *pDepthInColorSpace)
{
if (depthImageInColor == NULL)
{
k4a_image_create(K4A_IMAGE_FORMAT_DEPTH16, nColorFrameWidth, nColorFrameHeight,
nColorFrameWidth * (int)sizeof(uint16_t),
&depthImageInColor);
}
k4a_transformation_depth_image_to_color_camera(transformationColorDownscaled, depthImage, depthImageInColor);
memcpy(pDepthInColorSpace, k4a_image_get_buffer(depthImageInColor), nColorFrameHeight * nColorFrameWidth * (int)sizeof(uint16_t));
}
void AzureKinectCapture::MapColorFrameToDepthSpace(RGB* pColorInDepthSpace)
{
if (colorImageInDepth == NULL)
{
k4a_image_create(K4A_IMAGE_FORMAT_COLOR_BGRA32, nDepthFrameWidth, nDepthFrameHeight,
nDepthFrameWidth * 4 * (int)sizeof(uint8_t),
&colorImageInDepth);
}
k4a_transformation_color_image_to_depth_camera(transformationColorDownscaled, depthImage, colorImage, colorImageInDepth);
memcpy(pColorInDepthSpace, k4a_image_get_buffer(colorImageInDepth), nDepthFrameHeight * nDepthFrameWidth * 4 * (int)sizeof(uint8_t));
}
/// <summary>
/// Enables/Disables Auto Exposure and/or sets the exposure to a step value between -11 and -5
/// The kinect supports exposure values up to 1, but these are only available in lower FPS modes (5 or 15 FPS)
/// For further information on how this value translates to ms-Values, please take a look
/// at this table: https://github.com/microsoft/Azure-Kinect-Sensor-SDK/blob/develop/src/color/color_priv.h
/// </summary>
/// <param name="exposureStep">The Exposure Step between -11 and 1</param>
void AzureKinectCapture::SetExposureState(bool enableAutoExposure, int exposureStep)
{
if (bInitialized)
{
if (enableAutoExposure)
{
k4a_device_set_color_control(kinectSensor, K4A_COLOR_CONTROL_EXPOSURE_TIME_ABSOLUTE, K4A_COLOR_CONTROL_MODE_AUTO, 0);
autoExposureEnabled = true;
}
else
{
//Formula copied from here: https://github.com/microsoft/Azure-Kinect-Sensor-SDK/blob/7cd8683a1a71b8baebef4a3537e6edd8639d1e95/examples/k4arecorder/main.cpp#L333
float absExposure = (exp2f((float)exposureStep) * 1000000.0f);
//We add 0.5 because C++ always truncates when converting to an integer.
//This ensures that values will always be rounded correctly
float absExposureRoundingMargin = absExposure + 0.5;
int32_t absoluteExposureInt = (int32_t)absExposureRoundingMargin;
k4a_device_set_color_control(kinectSensor, K4A_COLOR_CONTROL_EXPOSURE_TIME_ABSOLUTE, K4A_COLOR_CONTROL_MODE_MANUAL, absoluteExposureInt);
autoExposureEnabled = false;
exposureTimeStep = exposureStep;
}
}
}
/// <summary>
/// Determines if this camera is configured as a Master, Subordinate or Standalone.
/// This is achieved by looking at how the sync out and sync in ports of the device are connected
/// </summary>
/// <returns>Returns int -1 for Subordinate, int 0 for Master and int 1 for Standalone</returns>
int AzureKinectCapture::GetSyncJackState()
{
if (K4A_RESULT_SUCCEEDED == k4a_device_get_sync_jack(kinectSensor, &syncInConnected, &syncOutConnected))
{
if (syncInConnected)
{
return -1; //Device is Subordinate, as it recieves a signal via its "Sync In" Port
}
else if (!syncInConnected && syncOutConnected)
{
return 0; //Device is Master, as it doens't recieve a signal from its "Sync In" Port, but sends one through its "Sync Out" Port
}
else
{
return 1; //Device is Standalone, as it doesn't have a valid cabel configuration on its Sync Ports
}
}
else
{
return 1; //Probably failed because there are no cabels connected, this means the device should be set as standalone
}
}
uint64_t AzureKinectCapture::GetTimeStamp()
{
return currentTimeStamp;
}
int AzureKinectCapture::GetDeviceIndex()
{
return deviceIDForRestart;
}
+5 -8
View File
@@ -14,7 +14,6 @@
// } // }
#include "calibration.h" #include "calibration.h"
#include "Kinect.h"
#include "opencv\cv.h" #include "opencv\cv.h"
#include <fstream> #include <fstream>
@@ -125,15 +124,13 @@ bool Calibration::Calibrate(RGB *pBuffer, Point3f *pCameraCoordinates, int cColo
marker3DSamples.clear(); marker3DSamples.clear();
nSampleCounter = 0; nSampleCounter = 0;
SaveCalibration();
return true; return true;
} }
bool Calibration::LoadCalibration() bool Calibration::LoadCalibration(const string &serialNumber)
{ {
ifstream file; ifstream file;
file.open("calibration.txt"); file.open("calibration_" + serialNumber + ".txt");
if (!file.is_open()) if (!file.is_open())
return false; return false;
@@ -150,10 +147,10 @@ bool Calibration::LoadCalibration()
return true; return true;
} }
void Calibration::SaveCalibration() void Calibration::SaveCalibration(const string &serialNumber)
{ {
ofstream file; ofstream file;
file.open("calibration.txt"); file.open("calibration_" + serialNumber + ".txt");
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
file << worldT[i] << " "; file << worldT[i] << " ";
file << endl; file << endl;
@@ -262,7 +259,7 @@ bool Calibration::GetMarkerCorners3D(vector<Point3f> &marker3D, MarkerInfo &mark
Point3f pointXMinYMax = pCameraCoordinates[minX + maxY * cColorWidth]; Point3f pointXMinYMax = pCameraCoordinates[minX + maxY * cColorWidth];
Point3f pointMax = pCameraCoordinates[maxX + maxY * cColorWidth]; Point3f pointMax = pCameraCoordinates[maxX + maxY * cColorWidth];
if (pointMin.Z < 0 || pointXMaxYMin.Z < 0 || pointXMinYMax.Z < 0 || pointMax.Z < 0) if (pointMin.Z <= 0 || pointXMaxYMin.Z <= 0 || pointXMinYMax.Z <= 0 || pointMax.Z <= 0)
return false; return false;
marker3D[i].X = (1 - dx) * (1 - dy) * pointMin.X + dx * (1 - dy) * pointXMaxYMin.X + (1 - dx) * dy * pointXMinYMax.X + dx * dy * pointMax.X; marker3D[i].X = (1 - dx) * (1 - dy) * pointMin.X + dx * (1 - dy) * pointXMaxYMin.X + (1 - dx) * dy * pointXMinYMax.X + dx * dy * pointMax.X;
+7 -5
View File
@@ -39,14 +39,14 @@ void FrameFileWriterReader::openCurrentFileForReading()
m_bFileOpenedForWriting = false; m_bFileOpenedForWriting = false;
} }
void FrameFileWriterReader::openNewFileForWriting() void FrameFileWriterReader::openNewFileForWriting(int deviceID)
{ {
closeFileIfOpened(); closeFileIfOpened();
char filename[1024]; char filename[1024];
time_t t = time(0); time_t t = time(0);
struct tm * now = localtime(&t); struct tm * now = localtime(&t);
sprintf(filename, "recording_%04d_%02d_%02d_%02d_%02d.bin", now->tm_year + 1900, now->tm_mon + 1, now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec); sprintf(filename, "recording_%01d_%04d_%02d_%02d_%02d_%02d.bin", deviceID, now->tm_year + 1900, now->tm_mon + 1, now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec);
m_sFilename = filename; m_sFilename = filename;
m_pFileHandle = fopen(filename, "wb"); m_pFileHandle = fopen(filename, "wb");
@@ -86,15 +86,17 @@ bool FrameFileWriterReader::readFrame(std::vector<Point3s> &outPoints, std::vect
} }
void FrameFileWriterReader::writeFrame(std::vector<Point3s> points, std::vector<RGB> colors) void FrameFileWriterReader::writeFrame(std::vector<Point3s> points, std::vector<RGB> colors, uint64_t timestamp, int deviceID)
{ {
if (!m_bFileOpenedForWriting) if (!m_bFileOpenedForWriting)
openNewFileForWriting(); openNewFileForWriting(deviceID);
FILE *f = m_pFileHandle; FILE *f = m_pFileHandle;
int nPoints = static_cast<int>(points.size()); int nPoints = static_cast<int>(points.size());
fprintf(f, "n_points= %d\nframe_timestamp= %d\n", nPoints, getRecordingTimeMilliseconds());
//The Timestamp is generated by the Kinect instead of the system. If temporal Sync is enabled, Master and Subordinate have a synced timestamp
fprintf(f, "n_points= %d\nframe_timestamp= %d\n", nPoints, timestamp);
if (nPoints > 0) if (nPoints > 0)
{ {
fwrite((void*)points.data(), sizeof(points[0]), nPoints, f); fwrite((void*)points.data(), sizeof(points[0]), nPoints, f);
+89 -89
View File
@@ -167,7 +167,7 @@ HRESULT ImageRenderer::Draw(BYTE* pImage, unsigned long cbImage, std::vector<Bod
{ {
if (vBodies[i].bTracked) if (vBodies[i].bTracked)
{ {
DrawBody(vBodies[i]); //DrawBody(vBodies[i]);
} }
} }
@@ -188,62 +188,62 @@ HRESULT ImageRenderer::Draw(BYTE* pImage, unsigned long cbImage, std::vector<Bod
/// Draws all the body to the associated hwnd, assumes that BeginDraw has been called /// Draws all the body to the associated hwnd, assumes that BeginDraw has been called
/// </summary> /// </summary>
/// <param name="body">body to be drawn</param> /// <param name="body">body to be drawn</param>
void ImageRenderer::DrawBody(Body &body) //void ImageRenderer::DrawBody(Body &body)
{ //{
// Draw the bones // // Draw the bones
//
// Torso // // Torso
DrawBone(body, JointType_Head, JointType_Neck); // DrawBone(body, JointType_Head, JointType_Neck);
DrawBone(body, JointType_Neck, JointType_SpineShoulder); // DrawBone(body, JointType_Neck, JointType_SpineShoulder);
DrawBone(body, JointType_SpineShoulder, JointType_SpineMid); // DrawBone(body, JointType_SpineShoulder, JointType_SpineMid);
DrawBone(body, JointType_SpineMid, JointType_SpineBase); // DrawBone(body, JointType_SpineMid, JointType_SpineBase);
DrawBone(body, JointType_SpineShoulder, JointType_ShoulderRight); // DrawBone(body, JointType_SpineShoulder, JointType_ShoulderRight);
DrawBone(body, JointType_SpineShoulder, JointType_ShoulderLeft); // DrawBone(body, JointType_SpineShoulder, JointType_ShoulderLeft);
DrawBone(body, JointType_SpineBase, JointType_HipRight); // DrawBone(body, JointType_SpineBase, JointType_HipRight);
DrawBone(body, JointType_SpineBase, JointType_HipLeft); // DrawBone(body, JointType_SpineBase, JointType_HipLeft);
//
// Right Arm // // Right Arm
DrawBone(body, JointType_ShoulderRight, JointType_ElbowRight); // DrawBone(body, JointType_ShoulderRight, JointType_ElbowRight);
DrawBone(body, JointType_ElbowRight, JointType_WristRight); // DrawBone(body, JointType_ElbowRight, JointType_WristRight);
DrawBone(body, JointType_WristRight, JointType_HandRight); // DrawBone(body, JointType_WristRight, JointType_HandRight);
DrawBone(body, JointType_HandRight, JointType_HandTipRight); // DrawBone(body, JointType_HandRight, JointType_HandTipRight);
DrawBone(body, JointType_WristRight, JointType_ThumbRight); // DrawBone(body, JointType_WristRight, JointType_ThumbRight);
//
// Left Arm // // Left Arm
DrawBone(body, JointType_ShoulderLeft, JointType_ElbowLeft); // DrawBone(body, JointType_ShoulderLeft, JointType_ElbowLeft);
DrawBone(body, JointType_ElbowLeft, JointType_WristLeft); // DrawBone(body, JointType_ElbowLeft, JointType_WristLeft);
DrawBone(body, JointType_WristLeft, JointType_HandLeft); // DrawBone(body, JointType_WristLeft, JointType_HandLeft);
DrawBone(body, JointType_HandLeft, JointType_HandTipLeft); // DrawBone(body, JointType_HandLeft, JointType_HandTipLeft);
DrawBone(body, JointType_WristLeft, JointType_ThumbLeft); // DrawBone(body, JointType_WristLeft, JointType_ThumbLeft);
//
// Right Leg // // Right Leg
DrawBone(body, JointType_HipRight, JointType_KneeRight); // DrawBone(body, JointType_HipRight, JointType_KneeRight);
DrawBone(body, JointType_KneeRight, JointType_AnkleRight); // DrawBone(body, JointType_KneeRight, JointType_AnkleRight);
DrawBone(body, JointType_AnkleRight, JointType_FootRight); // DrawBone(body, JointType_AnkleRight, JointType_FootRight);
//
// Left Leg // // Left Leg
DrawBone(body, JointType_HipLeft, JointType_KneeLeft); // DrawBone(body, JointType_HipLeft, JointType_KneeLeft);
DrawBone(body, JointType_KneeLeft, JointType_AnkleLeft); // DrawBone(body, JointType_KneeLeft, JointType_AnkleLeft);
DrawBone(body, JointType_AnkleLeft, JointType_FootLeft); // DrawBone(body, JointType_AnkleLeft, JointType_FootLeft);
//
for (unsigned int i = 0; i < body.vJoints.size(); i++) // for (unsigned int i = 0; i < body.vJoints.size(); i++)
{ // {
D2D1_POINT_2F tempPoint; // D2D1_POINT_2F tempPoint;
tempPoint.x = body.vJointsInColorSpace[i].X; // tempPoint.x = body.vJointsInColorSpace[i].X;
tempPoint.y = body.vJointsInColorSpace[i].Y; // tempPoint.y = body.vJointsInColorSpace[i].Y;
//
D2D1_ELLIPSE ellipse = D2D1::Ellipse(tempPoint, 6.0f, 6.0f); // D2D1_ELLIPSE ellipse = D2D1::Ellipse(tempPoint, 6.0f, 6.0f);
//
if (body.vJoints[i].TrackingState == TrackingState_Inferred) // if (body.vJoints[i].TrackingState == TrackingState_Inferred)
{ // {
m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointInferred); // m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointInferred);
} // }
else if (body.vJoints[i].TrackingState == TrackingState_Tracked) // else if (body.vJoints[i].TrackingState == TrackingState_Tracked)
{ // {
m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointTracked); // m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointTracked);
} // }
} // }
} //}
/// <summary> /// <summary>
/// Draws one bone of a body (joint to joint) /// Draws one bone of a body (joint to joint)
@@ -251,35 +251,35 @@ void ImageRenderer::DrawBody(Body &body)
/// <param name="body">body to be drawn</param> /// <param name="body">body to be drawn</param>
/// <param name="joint0">one joint of the bone to draw</param> /// <param name="joint0">one joint of the bone to draw</param>
/// <param name="joint1">other joint of the bone to draw</param> /// <param name="joint1">other joint of the bone to draw</param>
void ImageRenderer::DrawBone(Body &body, JointType joint0, JointType joint1) //void ImageRenderer::DrawBone(Body &body, JointType joint0, JointType joint1)
{ //{
TrackingState joint0State = body.vJoints[joint0].TrackingState; // TrackingState joint0State = body.vJoints[joint0].TrackingState;
TrackingState joint1State = body.vJoints[joint1].TrackingState; // TrackingState joint1State = body.vJoints[joint1].TrackingState;
//
// If we can't find either of these joints, exit // // If we can't find either of these joints, exit
if ((joint0State == TrackingState_NotTracked) || (joint1State == TrackingState_NotTracked)) // if ((joint0State == TrackingState_NotTracked) || (joint1State == TrackingState_NotTracked))
{ // {
return; // return;
} // }
//
// Don't draw if both points are inferred // // Don't draw if both points are inferred
if ((joint0State == TrackingState_Inferred) && (joint1State == TrackingState_Inferred)) // if ((joint0State == TrackingState_Inferred) && (joint1State == TrackingState_Inferred))
{ // {
return; // return;
} // }
//
D2D1_POINT_2F joint0Point, joint1Point; // D2D1_POINT_2F joint0Point, joint1Point;
joint0Point.x = body.vJointsInColorSpace[joint0].X; // joint0Point.x = body.vJointsInColorSpace[joint0].X;
joint0Point.y = body.vJointsInColorSpace[joint0].Y; // joint0Point.y = body.vJointsInColorSpace[joint0].Y;
joint1Point.x = body.vJointsInColorSpace[joint1].X; // joint1Point.x = body.vJointsInColorSpace[joint1].X;
joint1Point.y = body.vJointsInColorSpace[joint1].Y; // joint1Point.y = body.vJointsInColorSpace[joint1].Y;
// We assume all drawn bones are inferred unless BOTH joints are tracked // // We assume all drawn bones are inferred unless BOTH joints are tracked
if ((joint0State == TrackingState_Tracked) && (joint1State == TrackingState_Tracked)) // if ((joint0State == TrackingState_Tracked) && (joint1State == TrackingState_Tracked))
{ // {
m_pRenderTarget->DrawLine(joint0Point, joint1Point, m_pBrushBoneTracked, 10.0f); // m_pRenderTarget->DrawLine(joint0Point, joint1Point, m_pBrushBoneTracked, 10.0f);
} // }
else // else
{ // {
m_pRenderTarget->DrawLine(joint0Point, joint1Point, m_pBrushBoneInferred, 3); // m_pRenderTarget->DrawLine(joint0Point, joint1Point, m_pBrushBoneInferred, 3);
} // }
} //}
-250
View File
@@ -1,250 +0,0 @@
// Copyright (C) 2015 Marek Kowalski (M.Kowalski@ire.pw.edu.pl), Jacek Naruniec (J.Naruniec@ire.pw.edu.pl)
// License: MIT Software License See LICENSE.txt for the full license.
// If you use this software in your research, then please use the following citation:
// Kowalski, M.; Naruniec, J.; Daniluk, M.: "LiveScan3D: A Fast and Inexpensive 3D Data
// Acquisition System for Multiple Kinect v2 Sensors". in 3D Vision (3DV), 2015 International Conference on, Lyon, France, 2015
// @INPROCEEDINGS{Kowalski15,
// author={Kowalski, M. and Naruniec, J. and Daniluk, M.},
// booktitle={3D Vision (3DV), 2015 International Conference on},
// title={LiveScan3D: A Fast and Inexpensive 3D Data Acquisition System for Multiple Kinect v2 Sensors},
// year={2015},
// }
#include "KinectCapture.h"
#include <chrono>
KinectCapture::KinectCapture()
{
pKinectSensor = NULL;
pCoordinateMapper = NULL;
pMultiSourceFrameReader = NULL;
}
KinectCapture::~KinectCapture()
{
SafeRelease(pKinectSensor);
SafeRelease(pCoordinateMapper);
SafeRelease(pMultiSourceFrameReader);
}
bool KinectCapture::Initialize()
{
HRESULT hr;
hr = GetDefaultKinectSensor(&pKinectSensor);
if (FAILED(hr))
{
bInitialized = false;
return bInitialized;
}
if (pKinectSensor)
{
pKinectSensor->get_CoordinateMapper(&pCoordinateMapper);
hr = pKinectSensor->Open();
if (SUCCEEDED(hr))
{
pKinectSensor->OpenMultiSourceFrameReader(FrameSourceTypes::FrameSourceTypes_Color |
FrameSourceTypes::FrameSourceTypes_Depth |
FrameSourceTypes::FrameSourceTypes_Body |
FrameSourceTypes::FrameSourceTypes_BodyIndex,
&pMultiSourceFrameReader);
}
}
bInitialized = SUCCEEDED(hr);
if (bInitialized)
{
std::chrono::time_point<std::chrono::system_clock> start = std::chrono::system_clock::now();
bool bTemp;
do
{
bTemp = AcquireFrame();
std::chrono::duration<double> elapsedSeconds = std::chrono::system_clock::now() - start;
if (elapsedSeconds.count() > 5.0)
{
bInitialized = false;
break;
}
} while (!bTemp);
}
return bInitialized;
}
bool KinectCapture::AcquireFrame()
{
if (!bInitialized)
{
return false;
}
//Multi frame
IMultiSourceFrame* pMultiFrame = NULL;
HRESULT hr = pMultiSourceFrameReader->AcquireLatestFrame(&pMultiFrame);
if (!SUCCEEDED(hr))
{
return false;
}
GetDepthFrame(pMultiFrame);
GetColorFrame(pMultiFrame);
GetBodyFrame(pMultiFrame);
GetBodyIndexFrame(pMultiFrame);
SafeRelease(pMultiFrame);
return true;
}
void KinectCapture::MapDepthFrameToCameraSpace(Point3f *pCameraSpacePoints)
{
pCoordinateMapper->MapDepthFrameToCameraSpace(nDepthFrameWidth * nDepthFrameHeight, pDepth, nDepthFrameWidth * nDepthFrameHeight, (CameraSpacePoint*)pCameraSpacePoints);
}
void KinectCapture::MapColorFrameToCameraSpace(Point3f *pCameraSpacePoints)
{
pCoordinateMapper->MapColorFrameToCameraSpace(nDepthFrameWidth * nDepthFrameHeight, pDepth, nColorFrameWidth * nColorFrameHeight, (CameraSpacePoint*)pCameraSpacePoints);
}
void KinectCapture::MapDepthFrameToColorSpace(Point2f *pColorSpacePoints)
{
pCoordinateMapper->MapDepthFrameToColorSpace(nDepthFrameWidth * nDepthFrameHeight, pDepth, nDepthFrameWidth * nDepthFrameHeight, (ColorSpacePoint*)pColorSpacePoints);
}
void KinectCapture::MapColorFrameToDepthSpace(Point2f *pDepthSpacePoints)
{
pCoordinateMapper->MapColorFrameToDepthSpace(nDepthFrameWidth * nDepthFrameHeight, pDepth, nColorFrameWidth * nColorFrameHeight, (DepthSpacePoint*)pDepthSpacePoints);;
}
void KinectCapture::GetDepthFrame(IMultiSourceFrame* pMultiFrame)
{
IDepthFrameReference* pDepthFrameReference = NULL;
IDepthFrame* pDepthFrame = NULL;
pMultiFrame->get_DepthFrameReference(&pDepthFrameReference);
HRESULT hr = pDepthFrameReference->AcquireFrame(&pDepthFrame);
if (SUCCEEDED(hr))
{
if (pDepth == NULL)
{
IFrameDescription* pFrameDescription = NULL;
hr = pDepthFrame->get_FrameDescription(&pFrameDescription);
pFrameDescription->get_Width(&nDepthFrameWidth);
pFrameDescription->get_Height(&nDepthFrameHeight);
pDepth = new UINT16[nDepthFrameHeight * nDepthFrameWidth];
SafeRelease(pFrameDescription);
}
UINT nBufferSize = nDepthFrameHeight * nDepthFrameWidth;
hr = pDepthFrame->CopyFrameDataToArray(nBufferSize, pDepth);
}
SafeRelease(pDepthFrame);
SafeRelease(pDepthFrameReference);
}
void KinectCapture::GetColorFrame(IMultiSourceFrame* pMultiFrame)
{
IColorFrameReference* pColorFrameReference = NULL;
IColorFrame* pColorFrame = NULL;
pMultiFrame->get_ColorFrameReference(&pColorFrameReference);
HRESULT hr = pColorFrameReference->AcquireFrame(&pColorFrame);
if (SUCCEEDED(hr))
{
if (pColorRGBX == NULL)
{
IFrameDescription* pFrameDescription = NULL;
hr = pColorFrame->get_FrameDescription(&pFrameDescription);
hr = pFrameDescription->get_Width(&nColorFrameWidth);
hr = pFrameDescription->get_Height(&nColorFrameHeight);
pColorRGBX = new RGB[nColorFrameWidth * nColorFrameHeight];
SafeRelease(pFrameDescription);
}
UINT nBufferSize = nColorFrameWidth * nColorFrameHeight * sizeof(RGB);
hr = pColorFrame->CopyConvertedFrameDataToArray(nBufferSize, reinterpret_cast<BYTE*>(pColorRGBX), ColorImageFormat_Bgra);
}
SafeRelease(pColorFrame);
SafeRelease(pColorFrameReference);
}
void KinectCapture::GetBodyFrame(IMultiSourceFrame* pMultiFrame)
{
IBodyFrameReference* pBodyFrameReference = NULL;
IBodyFrame* pBodyFrame = NULL;
pMultiFrame->get_BodyFrameReference(&pBodyFrameReference);
HRESULT hr = pBodyFrameReference->AcquireFrame(&pBodyFrame);
if (SUCCEEDED(hr))
{
IBody* bodies[BODY_COUNT] = { NULL };
pBodyFrame->GetAndRefreshBodyData(BODY_COUNT, bodies);
vBodies = std::vector<Body>(BODY_COUNT);
for (int i = 0; i < BODY_COUNT; i++)
{
if (bodies[i])
{
Joint joints[JointType_Count];
BOOLEAN isTracked;
bodies[i]->get_IsTracked(&isTracked);
bodies[i]->GetJoints(JointType_Count, joints);
vBodies[i].vJoints.assign(joints, joints + JointType_Count);
if (isTracked == TRUE)
vBodies[i].bTracked = true;
else
vBodies[i].bTracked = false;
vBodies[i].vJointsInColorSpace.resize(JointType_Count);
for (int j = 0; j < JointType_Count; j++)
{
ColorSpacePoint tempPoint;
pCoordinateMapper->MapCameraPointToColorSpace(joints[j].Position, &tempPoint);
vBodies[i].vJointsInColorSpace[j].X = tempPoint.X;
vBodies[i].vJointsInColorSpace[j].Y = tempPoint.Y;
}
}
}
}
SafeRelease(pBodyFrame);
SafeRelease(pBodyFrameReference);
}
void KinectCapture::GetBodyIndexFrame(IMultiSourceFrame* pMultiFrame)
{
IBodyIndexFrameReference* pBodyIndexFrameReference = NULL;
IBodyIndexFrame* pBodyIndexFrame = NULL;
pMultiFrame->get_BodyIndexFrameReference(&pBodyIndexFrameReference);
HRESULT hr = pBodyIndexFrameReference->AcquireFrame(&pBodyIndexFrame);
if (SUCCEEDED(hr))
{
if (pBodyIndex == NULL)
{
pBodyIndex = new BYTE[nDepthFrameHeight * nDepthFrameWidth];
}
UINT nBufferSize = nDepthFrameHeight * nDepthFrameWidth;
hr = pBodyIndexFrame->CopyFrameDataToArray(nBufferSize, pBodyIndex);
}
SafeRelease(pBodyIndexFrame);
SafeRelease(pBodyIndexFrameReference);
}
+286 -94
View File
@@ -38,17 +38,17 @@ int APIENTRY wWinMain(
} }
LiveScanClient::LiveScanClient() : LiveScanClient::LiveScanClient() :
m_hWnd(NULL), m_hWnd(NULL),
m_nLastCounter(0), m_nLastCounter(0),
m_nFramesSinceUpdate(0), m_nFramesSinceUpdate(0),
m_fFreq(0), m_fFreq(0),
m_nNextStatusTime(0LL), m_nNextStatusTime(0LL),
m_pD2DFactory(NULL), m_pD2DFactory(NULL),
m_pDrawColor(NULL), m_pDrawColor(NULL),
m_pDepthRGBX(NULL), m_pDepthRGBX(NULL),
m_pCameraSpaceCoordinates(NULL), m_pCameraSpaceCoordinates(NULL),
m_pColorCoordinatesOfDepth(NULL), m_pColorInColorSpace(NULL),
m_pDepthCoordinatesOfColor(NULL), m_pDepthInColorSpace(NULL),
m_bCalibrate(false), m_bCalibrate(false),
m_bFilter(false), m_bFilter(false),
m_bStreamOnlyBodies(false), m_bStreamOnlyBodies(false),
@@ -56,15 +56,19 @@ LiveScanClient::LiveScanClient() :
m_bConnected(false), m_bConnected(false),
m_bConfirmCaptured(false), m_bConfirmCaptured(false),
m_bConfirmCalibrated(false), m_bConfirmCalibrated(false),
m_bConfirmRestartAsMaster(false),
m_bShowDepth(false), m_bShowDepth(false),
m_bSocketThread(true), m_bSocketThread(true),
m_bFrameCompression(true), m_bFrameCompression(true),
m_iCompressionLevel(2), m_iCompressionLevel(2),
m_pClientSocket(NULL), m_pClientSocket(NULL),
m_nFilterNeighbors(10), m_nFilterNeighbors(10),
m_fFilterThreshold(0.01f) m_fFilterThreshold(0.01f),
m_bRestartingCamera(false),
m_bAutoExposureEnabled(true), // Which state the Auto Exposure should be set to
m_nExposureStep(-5)
{ {
pCapture = new KinectCapture(); pCapture = new AzureKinectCapture();
LARGE_INTEGER qpf = {0}; LARGE_INTEGER qpf = {0};
if (QueryPerformanceFrequency(&qpf)) if (QueryPerformanceFrequency(&qpf))
@@ -78,8 +82,6 @@ LiveScanClient::LiveScanClient() :
m_vBounds.push_back(0.5); m_vBounds.push_back(0.5);
m_vBounds.push_back(0.5); m_vBounds.push_back(0.5);
m_vBounds.push_back(0.5); m_vBounds.push_back(0.5);
calibration.LoadCalibration();
} }
LiveScanClient::~LiveScanClient() LiveScanClient::~LiveScanClient()
@@ -109,16 +111,16 @@ LiveScanClient::~LiveScanClient()
m_pCameraSpaceCoordinates = NULL; m_pCameraSpaceCoordinates = NULL;
} }
if (m_pColorCoordinatesOfDepth) if (m_pColorInColorSpace)
{ {
delete[] m_pColorCoordinatesOfDepth; delete[] m_pColorInColorSpace;
m_pColorCoordinatesOfDepth = NULL; m_pColorInColorSpace = NULL;
} }
if (m_pDepthCoordinatesOfColor) if (m_pDepthInColorSpace)
{ {
delete[] m_pDepthCoordinatesOfColor; delete[] m_pDepthInColorSpace;
m_pDepthCoordinatesOfColor = NULL; m_pDepthInColorSpace = NULL;
} }
if (m_pClientSocket) if (m_pClientSocket)
@@ -164,11 +166,14 @@ int LiveScanClient::Run(HINSTANCE hInstance, int nCmdShow)
// Main message loop // Main message loop
while (WM_QUIT != msg.message) while (WM_QUIT != msg.message)
{ {
//HandleSocket();
UpdateFrame(); UpdateFrame();
while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
{ {
if (WM_QUIT == msg.message)
{
break;
}
// If a dialog message will be taken care of by the dialog proc // If a dialog message will be taken care of by the dialog proc
if (hWndApp && IsDialogMessageW(hWndApp, &msg)) if (hWndApp && IsDialogMessageW(hWndApp, &msg))
{ {
@@ -185,8 +190,6 @@ int LiveScanClient::Run(HINSTANCE hInstance, int nCmdShow)
return static_cast<int>(msg.wParam); return static_cast<int>(msg.wParam);
} }
void LiveScanClient::UpdateFrame() void LiveScanClient::UpdateFrame()
{ {
if (!pCapture->bInitialized) if (!pCapture->bInitialized)
@@ -199,15 +202,16 @@ void LiveScanClient::UpdateFrame()
if (!bNewFrameAcquired) if (!bNewFrameAcquired)
return; return;
pCapture->MapDepthFrameToCameraSpace(m_pCameraSpaceCoordinates); pCapture->MapColorFrameToCameraSpace(m_pCameraSpaceCoordinates);
pCapture->MapDepthFrameToColorSpace(m_pColorCoordinatesOfDepth);
{ {
std::lock_guard<std::mutex> lock(m_mSocketThreadMutex); std::lock_guard<std::mutex> lock(m_mSocketThreadMutex);
StoreFrame(m_pCameraSpaceCoordinates, m_pColorCoordinatesOfDepth, pCapture->pColorRGBX, pCapture->vBodies, pCapture->pBodyIndex); StoreFrame(m_pCameraSpaceCoordinates, pCapture->pColorRGBX, pCapture->vBodies, pCapture->pBodyIndex);
if (m_bCaptureFrame) if (m_bCaptureFrame)
{ {
m_framesFileWriterReader.writeFrame(m_vLastFrameVertices, m_vLastFrameRGB); uint64_t timeStamp = pCapture->GetTimeStamp();
m_framesFileWriterReader.writeFrame(m_vLastFrameVertices, m_vLastFrameRGB, timeStamp, pCapture->GetDeviceIndex());
m_bConfirmCaptured = true; m_bConfirmCaptured = true;
m_bCaptureFrame = false; m_bCaptureFrame = false;
} }
@@ -225,15 +229,16 @@ void LiveScanClient::UpdateFrame()
if (res) if (res)
{ {
calibration.SaveCalibration(pCapture->serialNumber);
m_bConfirmCalibrated = true; m_bConfirmCalibrated = true;
m_bCalibrate = false; m_bCalibrate = false;
} }
} }
if (!m_bShowDepth) if (!m_bShowDepth)
ProcessColor(pCapture->pColorRGBX, pCapture->nColorFrameWidth, pCapture->nColorFrameHeight); ShowColor();
else else
ProcessDepth(pCapture->pDepth, pCapture->nDepthFrameWidth, pCapture->nDepthFrameHeight); ShowDepth();
ShowFPS(); ShowFPS();
} }
@@ -275,15 +280,16 @@ LRESULT CALLBACK LiveScanClient::DlgProc(HWND hWnd, UINT message, WPARAM wParam,
// Init Direct2D // Init Direct2D
D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pD2DFactory); D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pD2DFactory);
// Get and initialize the default Kinect sensor // Get and initialize the default Kinect sensor as standalone
bool res = pCapture->Initialize(); bool res = pCapture->Initialize(Standalone, 0);
if (res) if (res)
{ {
calibration.LoadCalibration(pCapture->serialNumber);
m_pDepthRGBX = new RGB[pCapture->nColorFrameWidth * pCapture->nColorFrameHeight]; m_pDepthRGBX = new RGB[pCapture->nColorFrameWidth * pCapture->nColorFrameHeight];
m_pDepthInColorSpace = new UINT16[pCapture->nColorFrameWidth * pCapture->nColorFrameHeight];
m_pCameraSpaceCoordinates = new Point3f[pCapture->nDepthFrameWidth * pCapture->nDepthFrameHeight]; m_pCameraSpaceCoordinates = new Point3f[pCapture->nColorFrameWidth * pCapture->nColorFrameHeight];
m_pColorCoordinatesOfDepth = new Point2f[pCapture->nDepthFrameWidth * pCapture->nDepthFrameHeight]; m_pColorInColorSpace = new RGB[pCapture->nColorFrameWidth * pCapture->nColorFrameHeight];
m_pDepthCoordinatesOfColor = new Point2f[pCapture->nColorFrameWidth * pCapture->nColorFrameHeight]; pCapture->SetExposureState(true, 0);
} }
else else
{ {
@@ -368,27 +374,17 @@ LRESULT CALLBACK LiveScanClient::DlgProc(HWND hWnd, UINT message, WPARAM wParam,
return FALSE; return FALSE;
} }
void LiveScanClient::ProcessDepth(const UINT16* pBuffer, int nWidth, int nHeight) void LiveScanClient::ShowDepth()
{ {
// Make sure we've received valid data // Make sure we've received valid data
if (m_pDepthRGBX && m_pDepthCoordinatesOfColor && pBuffer && (nWidth == pCapture->nDepthFrameWidth) && (nHeight == pCapture->nDepthFrameHeight)) if (m_pDepthRGBX && m_pDepthInColorSpace)
{ {
// end pixel is start + width*height - 1 pCapture->MapDepthFrameToColorSpace(m_pDepthInColorSpace);
const UINT16* pBufferEnd = pBuffer + (nWidth * nHeight);
pCapture->MapColorFrameToDepthSpace(m_pDepthCoordinatesOfColor);
for (int i = 0; i < pCapture->nColorFrameWidth * pCapture->nColorFrameHeight; i++) for (int i = 0; i < pCapture->nColorFrameWidth * pCapture->nColorFrameHeight; i++)
{ {
Point2f depthPoint = m_pDepthCoordinatesOfColor[i]; USHORT depth = m_pDepthInColorSpace[i];
BYTE intensity = 0; BYTE intensity = static_cast<BYTE>(depth % 256);
if (depthPoint.X >= 0 && depthPoint.Y >= 0)
{
int depthIdx = (int)(depthPoint.X + depthPoint.Y * pCapture->nDepthFrameWidth);
USHORT depth = pBuffer[depthIdx];
intensity = static_cast<BYTE>(depth % 256);
}
m_pDepthRGBX[i].rgbRed = intensity; m_pDepthRGBX[i].rgbRed = intensity;
m_pDepthRGBX[i].rgbGreen = intensity; m_pDepthRGBX[i].rgbGreen = intensity;
@@ -400,13 +396,13 @@ void LiveScanClient::ProcessDepth(const UINT16* pBuffer, int nWidth, int nHeight
} }
} }
void LiveScanClient::ProcessColor(RGB* pBuffer, int nWidth, int nHeight) void LiveScanClient::ShowColor()
{ {
// Make sure we've received valid data // Make sure we've received valid data
if (pBuffer && (nWidth == pCapture->nColorFrameWidth) && (nHeight == pCapture->nColorFrameHeight)) if (pCapture->pColorRGBX)
{ {
// Draw the data with Direct2D // Draw the data with Direct2D
m_pDrawColor->Draw(reinterpret_cast<BYTE*>(pBuffer), pCapture->nColorFrameWidth * pCapture->nColorFrameHeight * sizeof(RGB), pCapture->vBodies); m_pDrawColor->Draw(reinterpret_cast<BYTE*>(pCapture->pColorRGBX), pCapture->nColorFrameWidth * pCapture->nColorFrameHeight * sizeof(RGB), pCapture->vBodies);
} }
} }
@@ -453,6 +449,124 @@ void LiveScanClient::HandleSocket()
//calibrate //calibrate
else if (received[i] == MSG_CALIBRATE) else if (received[i] == MSG_CALIBRATE)
m_bCalibrate = true; m_bCalibrate = true;
//Enables Temporal sync on this client
else if (received[i] == MSG_SET_TEMPSYNC_ON) {
i++; //Get next byte (the sync Offset)
int syncOffset = received[i];
//Determine if this device is a subordinate, master, or standalone
int jackState = pCapture->GetSyncJackState();
bool res = false;
switch (jackState)
{
case -1:
currentTempSyncState = SUBORDINATE;
//Restart this device as Subordinate, with a unique syncOffset (send by the server)
m_bRestartingCamera = true;
res = pCapture->Close();
if (!res) {
SetStatusMessage(L"Subordinate device failed to close! Restart Application!", 10000, true);
return;
}
res = pCapture->Initialize(Subordinate, syncOffset);
if (!res) {
SetStatusMessage(L"Subordinate device failed to reinitialize! Restart Application!", 10000, true);
return;
}
//Confirm to the server, that we set this device as subordinate
m_bConfirmTempSyncState = true;
m_bRestartingCamera = false;
break;
case 0:
currentTempSyncState = MASTER;
//Only Close this device, as it needs to wait for all subordinates to start, before starting itself
m_bRestartingCamera = true;
res = pCapture->Close();
if (!res) {
SetStatusMessage(L"Master device failed to close! Restart Application!", 10000, true);
return;
}
m_bConfirmTempSyncState = true;
break;
case 1://Device is Standalone
currentTempSyncState = STANDALONE;
//Restart this device as Standalone
m_bRestartingCamera = true;
res = pCapture->Close();
if (!res) {
SetStatusMessage(L"Capture device failed to close! Restart Application!", 10000, true);
return;
}
res = pCapture->Initialize(Standalone, 0);
if (!res) {
SetStatusMessage(L"Capture device failed to reinitialize! Restart Application!", 10000, true);
return;
}
m_bConfirmTempSyncState = true;
m_bRestartingCamera = false;
break;
default:
break;
}
}
//Sets this device as Standalone
else if (received[i] == MSG_SET_TEMPSYNC_OFF) {
currentTempSyncState = STANDALONE;
m_bRestartingCamera = true;
bool res;
res = pCapture->Close();
if (!res) {
SetStatusMessage(L"Capture device failed to close! Restart Application!", 10000, true);
return;
}
res = pCapture->Initialize(Standalone, 0);
if (!res) {
SetStatusMessage(L"Capture device failed to reinitialize! Restart Application!", 10000, true);
return;
}
m_bConfirmTempSyncState = true;
m_bRestartingCamera = false;
}
//Got confirmation from the server that all subs have started, and we can now start the master
else if (received[i] == MSG_START_MASTER) {
if (currentTempSyncState == MASTER)
{
bool res = pCapture->Initialize(Master, 0);
if (!res) {
SetStatusMessage(L"Master device failed to reinitialize! Restart Application!", 10000, true);
return;
}
m_bConfirmRestartAsMaster = true;
m_bRestartingCamera = false;
}
}
//receive settings //receive settings
//TODO: what if packet is split? //TODO: what if packet is split?
else if (received[i] == MSG_RECEIVE_SETTINGS) else if (received[i] == MSG_RECEIVE_SETTINGS)
@@ -515,6 +629,14 @@ void LiveScanClient::HandleSocket()
else else
m_bFrameCompression = false; m_bFrameCompression = false;
m_bAutoExposureEnabled = (received[i] != 0);
i++;
m_nExposureStep = *(int*)(received.c_str() + i);
i += sizeof(int);
pCapture->SetExposureState(m_bAutoExposureEnabled, m_nExposureStep);
//so that we do not lose the next character in the stream //so that we do not lose the next character in the stream
i--; i--;
} }
@@ -567,6 +689,18 @@ void LiveScanClient::HandleSocket()
{ {
m_framesFileWriterReader.closeFileIfOpened(); m_framesFileWriterReader.closeFileIfOpened();
} }
else if (received[i] == MSG_REQUEST_SYNC_JACK_STATE)
{
int size = 3;
char* buffer = new char[size];
buffer[0] = MSG_SYNC_JACK_STATE;
buffer[1] = pCapture->GetSyncJackState() + 1; //Gets the current Sync Jack State and adds + 1, as we can't send a negative value
m_pClientSocket->SendBytes(buffer, size);
m_bConfirmTempSyncState = false;
}
} }
if (m_bConfirmCaptured) if (m_bConfirmCaptured)
@@ -576,6 +710,33 @@ void LiveScanClient::HandleSocket()
m_bConfirmCaptured = false; m_bConfirmCaptured = false;
} }
//Send validation to the server that this device has been set to a specific Sync State
if (m_bConfirmTempSyncState)
{
int size = 3; //Somehow it doesn't work when sending only two bytes?? (So we send an extra one)
char* buffer = new char[size];
buffer[0] = MSG_CONFIRM_TEMP_SYNC_STATUS;
switch (currentTempSyncState)
{
case SUBORDINATE: buffer[1] = 0; break;
case MASTER: buffer[1] = 1; break;
case STANDALONE: buffer[1] = 2; break;
}
m_pClientSocket->SendBytes(buffer, size);
m_bConfirmTempSyncState = false;
}
//Send validation to the server that the Master camera has started recording again
if (m_bConfirmRestartAsMaster)
{
byteToSend = MSG_CONFIRM_MASTER_RESTART;
m_pClientSocket->SendBytes(&byteToSend, 1);
m_bConfirmRestartAsMaster = false;
}
if (m_bConfirmCalibrated) if (m_bConfirmCalibrated)
{ {
int size = (9 + 3) * sizeof(float) + sizeof(int) + 1; int size = (9 + 3) * sizeof(float) + sizeof(int) + 1;
@@ -648,24 +809,24 @@ void LiveScanClient::SendFrame(vector<Point3s> vertices, vector<RGB> RGB, vector
for (int j = 0; j < nJoints; j++) for (int j = 0; j < nJoints; j++)
{ {
//Joint ////Joint
memcpy(buffer.data() + pos, &body[i].vJoints[j].JointType, sizeof(JointType)); //memcpy(buffer.data() + pos, &body[i].vJoints[j].JointType, sizeof(JointType));
pos += sizeof(JointType); //pos += sizeof(JointType);
memcpy(buffer.data() + pos, &body[i].vJoints[j].TrackingState, sizeof(TrackingState)); //memcpy(buffer.data() + pos, &body[i].vJoints[j].TrackingState, sizeof(TrackingState));
pos += sizeof(TrackingState); //pos += sizeof(TrackingState);
//Joint position ////Joint position
memcpy(buffer.data() + pos, &body[i].vJoints[j].Position.X, sizeof(float)); //memcpy(buffer.data() + pos, &body[i].vJoints[j].Position.X, sizeof(float));
pos += sizeof(float); //pos += sizeof(float);
memcpy(buffer.data() + pos, &body[i].vJoints[j].Position.Y, sizeof(float)); //memcpy(buffer.data() + pos, &body[i].vJoints[j].Position.Y, sizeof(float));
pos += sizeof(float); //pos += sizeof(float);
memcpy(buffer.data() + pos, &body[i].vJoints[j].Position.Z, sizeof(float)); //memcpy(buffer.data() + pos, &body[i].vJoints[j].Position.Z, sizeof(float));
pos += sizeof(float); //pos += sizeof(float);
//JointInColorSpace ////JointInColorSpace
memcpy(buffer.data() + pos, &body[i].vJointsInColorSpace[j].X, sizeof(float)); //memcpy(buffer.data() + pos, &body[i].vJointsInColorSpace[j].X, sizeof(float));
pos += sizeof(float); //pos += sizeof(float);
memcpy(buffer.data() + pos, &body[i].vJointsInColorSpace[j].Y, sizeof(float)); //memcpy(buffer.data() + pos, &body[i].vJointsInColorSpace[j].Y, sizeof(float));
pos += sizeof(float); //pos += sizeof(float);
} }
} }
@@ -689,22 +850,28 @@ void LiveScanClient::SendFrame(vector<Point3s> vertices, vector<RGB> RGB, vector
m_pClientSocket->SendBytes(buffer.data(), size); m_pClientSocket->SendBytes(buffer.data(), size);
} }
void LiveScanClient::StoreFrame(Point3f *vertices, Point2f *mapping, RGB *color, vector<Body> &bodies, BYTE* bodyIndex) void LiveScanClient::StoreFrame(Point3f *vertices, RGB *colorInDepth, vector<Body> &bodies, BYTE* bodyIndex)
{ {
std::vector<Point3f> goodVertices; unsigned int nVertices = pCapture->nColorFrameHeight * pCapture->nColorFrameWidth;
std::vector<RGB> goodColorPoints;
unsigned int nVertices = pCapture->nDepthFrameWidth * pCapture->nDepthFrameHeight; //To save some processing cost, we allocate a full frame size (nVertices) of a Point3f Vector beforehand
//instead of using push_back for each vertice. Even though we have to copy the vertices into a clean array
//later and it uses a little bit more RAM, this gives us a nice speed increase for this function, around 25-50%
Point3f invalidPoint = Point3f(0, 0, 0, true);
vector<Point3f> AllVertices(nVertices);
int goodVerticesCount = 0;
for (unsigned int vertexIndex = 0; vertexIndex < nVertices; vertexIndex++) for (unsigned int vertexIndex = 0; vertexIndex < nVertices; vertexIndex++)
{ {
if (m_bStreamOnlyBodies && bodyIndex[vertexIndex] >= bodies.size()) if (m_bStreamOnlyBodies && bodyIndex[vertexIndex] >= bodies.size())
continue; continue;
if (vertices[vertexIndex].Z >= 0 && mapping[vertexIndex].Y >= 0 && mapping[vertexIndex].Y < pCapture->nColorFrameHeight) //As the resizing function doesn't return a valid RGB-Reserved value which indicates that this pixel is invalid,
//we cut all vertices under a distance of 0.0001mm, as the invalid vertices always have a Z-Value of 0
if (vertices[vertexIndex].Z >= 0.0001 && colorInDepth[vertexIndex].rgbReserved == 255)
{ {
Point3f temp = vertices[vertexIndex]; Point3f temp = vertices[vertexIndex];
RGB tempColor = color[(int)mapping[vertexIndex].X + (int)mapping[vertexIndex].Y * pCapture->nColorFrameWidth]; RGB tempColor = colorInDepth[vertexIndex];
if (calibration.bCalibrated) if (calibration.bCalibrated)
{ {
temp.X += calibration.worldT[0]; temp.X += calibration.worldT[0];
@@ -715,43 +882,68 @@ void LiveScanClient::StoreFrame(Point3f *vertices, Point2f *mapping, RGB *color,
if (temp.X < m_vBounds[0] || temp.X > m_vBounds[3] if (temp.X < m_vBounds[0] || temp.X > m_vBounds[3]
|| temp.Y < m_vBounds[1] || temp.Y > m_vBounds[4] || temp.Y < m_vBounds[1] || temp.Y > m_vBounds[4]
|| temp.Z < m_vBounds[2] || temp.Z > m_vBounds[5]) || temp.Z < m_vBounds[2] || temp.Z > m_vBounds[5])
{
AllVertices[vertexIndex] = invalidPoint;
continue; continue;
}
} }
goodVertices.push_back(temp); AllVertices[vertexIndex] = temp;
goodColorPoints.push_back(tempColor); goodVerticesCount++;
}
else
{
AllVertices[vertexIndex] = invalidPoint;
} }
} }
vector<Body> tempBodies = bodies; vector<Body> tempBodies = bodies;
for (unsigned int i = 0; i < tempBodies.size(); i++) //for (unsigned int i = 0; i < tempBodies.size(); i++)
//{
// for (unsigned int j = 0; j < tempBodies[i].vJoints.size(); j++)
// {
// if (calibration.bCalibrated)
// {
// tempBodies[i].vJoints[j].Position.X += calibration.worldT[0];
// tempBodies[i].vJoints[j].Position.Y += calibration.worldT[1];
// tempBodies[i].vJoints[j].Position.Z += calibration.worldT[2];
// Point3f tempPoint(tempBodies[i].vJoints[j].Position.X, tempBodies[i].vJoints[j].Position.Y, tempBodies[i].vJoints[j].Position.Z);
// tempPoint = RotatePoint(tempPoint, calibration.worldR);
// tempBodies[i].vJoints[j].Position.X = tempPoint.X;
// tempBodies[i].vJoints[j].Position.Y = tempPoint.Y;
// tempBodies[i].vJoints[j].Position.Z = tempPoint.Z;
// }
// }
//}
vector<Point3f> goodVertices(goodVerticesCount);
vector<RGB> goodColorPoints(goodVerticesCount);
int goodVerticesShortCounter = 0;
//Copy all valid vertices into a clean vector
for (unsigned int i = 0; i < AllVertices.size(); i++)
{ {
for (unsigned int j = 0; j < tempBodies[i].vJoints.size(); j++) if (!AllVertices[i].Invalid)
{ {
if (calibration.bCalibrated) goodVertices[goodVerticesShortCounter] = AllVertices[i];
{ goodColorPoints[goodVerticesShortCounter] = colorInDepth[i];
tempBodies[i].vJoints[j].Position.X += calibration.worldT[0]; goodVerticesShortCounter++;
tempBodies[i].vJoints[j].Position.Y += calibration.worldT[1];
tempBodies[i].vJoints[j].Position.Z += calibration.worldT[2];
Point3f tempPoint(tempBodies[i].vJoints[j].Position.X, tempBodies[i].vJoints[j].Position.Y, tempBodies[i].vJoints[j].Position.Z);
tempPoint = RotatePoint(tempPoint, calibration.worldR);
tempBodies[i].vJoints[j].Position.X = tempPoint.X;
tempBodies[i].vJoints[j].Position.Y = tempPoint.Y;
tempBodies[i].vJoints[j].Position.Z = tempPoint.Z;
}
} }
} }
if (m_bFilter) if (m_bFilter)
filter(goodVertices, goodColorPoints, m_nFilterNeighbors, m_fFilterThreshold); filter(goodVertices, goodColorPoints, m_nFilterNeighbors, m_fFilterThreshold);
vector<Point3s> goodVerticesShort(goodVertices.size()); vector<Point3s> goodVerticesShort(goodVertices.size());
for (unsigned int i = 0; i < goodVertices.size(); i++) for (size_t i = 0; i < goodVertices.size(); i++)
{ {
goodVerticesShort[i] = goodVertices[i]; goodVerticesShort[i] = goodVertices[i];
} }