Skip to content

Commit

Permalink
Slight polishing in support of Orbbec Femto devices. Preparations to …
Browse files Browse the repository at this point in the history
…release new version.
  • Loading branch information
bibigone committed Feb 4, 2024
1 parent 2cfe074 commit 8fd8149
Show file tree
Hide file tree
Showing 18 changed files with 156 additions and 17 deletions.
Binary file added K4AdotNet-Femto-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added K4AdotNet-Femto.ico
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@
<ProjectReference Include="..\K4AdotNet.Samples.Wpf.Common\K4AdotNet.Samples.Wpf.Common.csproj" />
</ItemGroup>

<ItemGroup>
<ItemGroup Condition="!$(DefineConstants.Contains(ORBBECSDK_K4A_WRAPPER))">
<Resource Include="..\K4AdotNet.ico" Link="K4AdotNet.ico" />
<Content Include="..\K4AdotNet.ico" Link="K4AdotNet.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup Condition="$(DefineConstants.Contains(ORBBECSDK_K4A_WRAPPER))">
<Resource Include="..\K4AdotNet-Femto.ico" Link="K4AdotNet.ico" />
<Content Include="..\K4AdotNet-Femto.ico" Link="K4AdotNet.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@
<ProjectReference Include="..\K4AdotNet.Samples.Wpf.Common\K4AdotNet.Samples.Wpf.Common.csproj" />
</ItemGroup>

<ItemGroup>
<ItemGroup Condition="!$(DefineConstants.Contains(ORBBECSDK_K4A_WRAPPER))">
<Resource Include="..\K4AdotNet.ico" Link="K4AdotNet.ico" />
<Content Include="..\K4AdotNet.ico" Link="K4AdotNet.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup Condition="$(DefineConstants.Contains(ORBBECSDK_K4A_WRAPPER))">
<Resource Include="..\K4AdotNet-Femto.ico" Link="K4AdotNet.ico" />
<Content Include="..\K4AdotNet-Femto.ico" Link="K4AdotNet.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@
<ProjectReference Include="..\K4AdotNet.Samples.Wpf.Common\K4AdotNet.Samples.Wpf.Common.csproj" />
</ItemGroup>

<ItemGroup>
<ItemGroup Condition="!$(DefineConstants.Contains(ORBBECSDK_K4A_WRAPPER))">
<Resource Include="..\K4AdotNet.ico" Link="K4AdotNet.ico" />
<Content Include="..\K4AdotNet.ico" Link="K4AdotNet.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup Condition="$(DefineConstants.Contains(ORBBECSDK_K4A_WRAPPER))">
<Resource Include="..\K4AdotNet-Femto.ico" Link="K4AdotNet.ico" />
<Content Include="..\K4AdotNet-Femto.ico" Link="K4AdotNet.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions K4AdotNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0 - Solution Items", "0 - S
.gitattributes = .gitattributes
.gitignore = .gitignore
K4AdotNet-64.png = K4AdotNet-64.png
K4AdotNet-Femto-64.png = K4AdotNet-Femto-64.png
K4AdotNet-Femto.ico = K4AdotNet-Femto.ico
K4AdotNet.ico = K4AdotNet.ico
LICENSE = LICENSE
Product.props = Product.props
Expand Down
8 changes: 4 additions & 4 deletions K4AdotNet/K4AdotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
</ItemGroup>

<ItemGroup Condition="'$(Platform)' == 'x64' And $(DefineConstants.Contains(ORBBECSDK_K4A_WRAPPER))">
<Content Include="..\externals\OrbbecSDK-K4A-Wrapper\win_x64\OrbbecSDK.dll" Link="OrbbecSDK.dll">
<Content Include="..\externals\OrbbecSDK-K4A-Wrapper\win-x64\OrbbecSDK.dll" Link="OrbbecSDK.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</Content>
<Content Include="..\externals\OrbbecSDK-K4A-Wrapper\win_x64\k4a.dll" Link="k4a.dll">
<Content Include="..\externals\OrbbecSDK-K4A-Wrapper\win-x64\k4a.dll" Link="k4a.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</Content>
<Content Include="..\externals\OrbbecSDK-K4A-Wrapper\win_x64\k4arecord.dll" Link="k4arecord.dll">
<Content Include="..\externals\OrbbecSDK-K4A-Wrapper\win-x64\k4arecord.dll" Link="k4arecord.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</Content>
<Content Include="..\externals\OrbbecSDK-K4A-Wrapper\win_x64\depthengine_2_0.dll" Link="depthengine_2_0.dll">
<Content Include="..\externals\OrbbecSDK-K4A-Wrapper\win-x64\depthengine_2_0.dll" Link="depthengine_2_0.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</Content>
Expand Down
13 changes: 13 additions & 0 deletions K4AdotNet/Sdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ namespace K4AdotNet
/// <summary>Static class with common basic things for Sensor, Record and Body Tracking APIs like logging, initializing, loading of dependencies, etc.</summary>
public static class Sdk
{
/// <summary>Is underlying level the OrbbecSDK K4A Wrapper rather than original Kinect for Azure SDK?</summary>
/// <remarks>
/// K4A.Net library can be compiled in version that supports Orbbec Femto depth sensors via Orbbec SDK K4A Wrapper.
/// There is no full compatibility between original Kinect for Azure SDK and OrbbecSDK-K4A-Wrapper.
/// To distinguish between them in client code, one can use this property.
/// </remarks>
public static bool IsOrbbecSdkK4AWrapper
#if ORBBECSDK_K4A_WRAPPER
=> true;
#else
=> false;
#endif

#region Dependencies

/// <summary>Name of main library (DLL) from Azure Kinect Sensor SDK.</summary>
Expand Down
8 changes: 5 additions & 3 deletions Product.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<Project>
<PropertyGroup>
<AssemblyVersion>1.4.14.0</AssemblyVersion>
<FileVersion>1.4.14.0</FileVersion>
<!--DefineConstants>ORBBECSDK_K4A_WRAPPER</DefineConstants-->
<AssemblyVersion>1.4.15.0</AssemblyVersion>
<FileVersion>1.4.15.0</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Devices)' == 'Femto'">
<DefineConstants>ORBBECSDK_K4A_WRAPPER</DefineConstants>
</PropertyGroup>
</Project>
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img align="right" width="64" height="64" src="https://github.com/bibigone/k4a.net/raw/master/K4AdotNet-64.png">

**K4A.Net** &mdash; *Three-in-one* managed .NET library to work with [Azure Kinect](https://azure.microsoft.com/en-us/services/kinect-dk/) devices (also known as Kinect for Azure, K4A, Kinect v4). It consists of the following "components":
**K4A.Net** &mdash; *Three-in-one* managed .NET library to work with [Azure Kinect](https://azure.microsoft.com/en-us/services/kinect-dk/) depth sensors (also known as Kinect for Azure, K4A, Kinect v4). Also it can be used to work with [Orbbec Femto Bolt](https://www.orbbec.com/products/tof-camera/femto-bolt/) and [Mega](https://www.orbbec.com/products/tof-camera/femto-mega/) depth sensors via [Orbbec SDK K4A Wrapper](https://github.com/orbbec/OrbbecSDK-K4A-Wrapper). It consists of the following "components":
1. `Sensor API` &mdash; access to depth camera, RGB camera, accelerometer and gyroscope, plus device-calibration data and synchronization control
* Corresponding namespace: `K4AdotNet.Sensor`
* Corresponding native API: [`k4a.h`](https://github.com/bibigone/k4a.net/blob/master/externals/k4a/include/k4a/k4a.h)
Expand All @@ -19,9 +19,9 @@
* Written fully on C#
* CLS-compliant (can be used from any .Net-compatible language, including C#, F#, VB.Net)
* Library **K4AdotNet** is compiled against **NET 6.0**, **.NET Standard 2.0** and **.NET Framework 4.6.1** target frameworks
* This makes it compatible with **.NET 5-7**, **.NET Core 2.0-3.1**, **.NET Framework 4.6.1** and later, **Unity 2018.1** and later, etc.
* This makes it compatible with **.NET 5-8**, **.NET Core 2.0-3.1**, **.NET Framework 4.6.1** and later, **Unity 2018.1** and later, etc.
* See https://docs.microsoft.com/en-us/dotnet/standard/net-standard for details
* Clean API, which is close to C/C++ native API from [Azure Kinect Sensor SDK](https://docs.microsoft.com/en-us/azure/Kinect-dk/sensor-sdk-download) and [Azure Kinect Body Tracking SDK](https://docs.microsoft.com/en-us/azure/Kinect-dk/body-sdk-download).
* Clean API, which is close to C/C++ native API from [Azure Kinect Sensor SDK](https://docs.microsoft.com/en-us/azure/Kinect-dk/sensor-sdk-download) (or [Orbbec SDK K4A Wrapper](https://github.com/orbbec/OrbbecSDK-K4A-Wrapper)) and [Azure Kinect Body Tracking SDK](https://docs.microsoft.com/en-us/azure/Kinect-dk/body-sdk-download).
* Plus useful helper methods, additional checks and meaningful exceptions.
* Full feature set (all API provided by native SDKs are available in this C# wrapper)
* Up-to-date with the latest versions of native SDKs
Expand All @@ -37,7 +37,9 @@
* Unit-tested
* Multi-platform (Windows, Linux)
* But most of samples are written using WPF
* Available as NuGet package: https://www.nuget.org/packages/K4AdotNet
* Available as NuGet packages:
* Azure Kinect version: https://www.nuget.org/packages/K4AdotNet
* Orbbec Femto Bolt/Mega version: https://www.nuget.org/packages/K4AdotNet-Femto


## Dependencies
Expand Down Expand Up @@ -94,3 +96,13 @@ See https://github.com/bibigone/k4a.net/releases
* `K4AdotNet.Samples.Wpf.BodyTracker` &mdash; sample WPF application to demonstrate usage of Body Tracking API.
* `K4AdotNet.Samples.Wpf.BackgroundRemover` &mdash; sample WPF application which implements the background removal effect for color picture with the help of depth data.
* Instruction on building Unity sample can be found [here](https://github.com/bibigone/k4a.net/blob/master/K4AdotNet.Samples.Unity/readme.md).

## Orbbec Femto Bolt/Mega support

<img align="right" width="64" height="64" src="https://github.com/bibigone/k4a.net/raw/master/K4AdotNet-Femto-64.png">

This library is compatible with [Orbbec Femto Bolt](https://www.orbbec.com/products/tof-camera/femto-bolt/) and [Mega](https://www.orbbec.com/products/tof-camera/femto-mega/) depth sensors. It is possible due to [Orbbec SDK K4A Wrapper](https://github.com/orbbec/OrbbecSDK-K4A-Wrapper) that implements the API of original native [K4A library](https://github.com/microsoft/Azure-Kinect-Sensor-SDK) via [Orbbec SDK](https://github.com/orbbec/OrbbecSDK).

`ORBBECSDK_K4A_WRAPPER` constant must be defined to compile the Orbbec-compatible version of the library. See `Product.props` file for details.

**Note.** There is no full compatibility between [Orbbec SDK K4A Wrapper](https://github.com/orbbec/OrbbecSDK-K4A-Wrapper) and original [K4A library](https://github.com/microsoft/Azure-Kinect-Sensor-SDK). Major differences between them are described [here](https://www.orbbec.com/documentation/comparison-with-azure-kinect-dk/). But actually there are much more inconsistencies. Check value of the `Sdk.IsOrbbecSdkK4AWrapper` property in client code to determine what version of library is in use.
27 changes: 27 additions & 0 deletions package/build-femto.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@ECHO OFF

set MSBUILD_PATH="%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MsBuild.exe"

cd ..

package\nuget.exe restore
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

%MSBUILD_PATH% K4AdotNet.sln /t:Clean /p:Configuration=Release /p:Platform="Any CPU" /p:Devices=Femto /v:m
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

%MSBUILD_PATH% K4AdotNet.sln /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" /p:Devices=Femto /v:m
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

cd package

nuget.exe pack k4adotnet-femto.nuspec
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

echo DONE!
exit /B 0

:ERROR
echo FAIL!
pause
exit /B -1
53 changes: 53 additions & 0 deletions package/k4adotnet-femto.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>K4AdotNet-Femto</id>
<version>1.4.15</version>
<authors>bibigone,baSSiLL</authors>
<owners></owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<projectUrl>https://github.com/bibigone/k4a.net/blob/master/README.md</projectUrl>
<iconUrl>https://github.com/bibigone/k4a.net/raw/master/K4AdotNet-Femto-64.png</iconUrl>
<description>Version of K4A.Net (K4AdotNet) library that works with Orbbec Femto Bolt and Mega depth sensors via Orbbec SDK K4A Wrapper. It includes sensor API, recording and playback API, body tracking API. The API is exactly the same as in original K4A.Net (K4AdotNet) library. Compatible with .NET Standard 2.0 and .Net Framework 4.6.1 and later, .NET 6 and later. All required binaries from Orbbec SDK K4A Wrapper (win x64) are included. Samples (WPF, .NET Core and Unity) can be found in the source repository.</description>
<releaseNotes>See https://github.com/bibigone/k4a.net/releases</releaseNotes>
<copyright>Copyright (c) 2019-2024</copyright>
<tags>Orbbec Femto Bolt Mega Kinect Azure .NET K4A Depth Sensor Body Tracking BodyTracking SDK Wrapper</tags>
<dependencies>
<group targetFramework=".NETFramework4.6.1" />
<group targetFramework="net6.0" />
<group targetFramework=".NETStandard2.0" />
</dependencies>
<frameworkAssemblies>
<frameworkAssembly assemblyName="mscorlib" targetFramework=".NETFramework4.6.1" />
<frameworkAssembly assemblyName="System.Core" targetFramework=".NETFramework4.6.1" />
<frameworkAssembly assemblyName="System" targetFramework=".NETFramework4.6.1" />
</frameworkAssemblies>
</metadata>

<files>
<file src="k4adotnet-femto.targets" target="build\k4adotnet-femto.targets" />

<file src="..\K4AdotNet\bin\Release\net461\K4AdotNet.dll" target="lib\net461\K4AdotNet.dll" />
<file src="..\K4AdotNet\bin\Release\net461\K4AdotNet.pdb" target="lib\net461\K4AdotNet.pdb" />
<file src="..\K4AdotNet\bin\Release\net461\K4AdotNet.xml" target="lib\net461\K4AdotNet.xml" />

<file src="..\K4AdotNet\bin\Release\net6.0\K4AdotNet.dll" target="lib\net6.0\K4AdotNet.dll" />
<file src="..\K4AdotNet\bin\Release\net6.0\K4AdotNet.pdb" target="lib\net6.0\K4AdotNet.pdb" />
<file src="..\K4AdotNet\bin\Release\net6.0\K4AdotNet.xml" target="lib\net6.0\K4AdotNet.xml" />

<file src="..\K4AdotNet\bin\Release\netstandard2.0\K4AdotNet.dll" target="lib\netstandard2.0\K4AdotNet.dll" />
<file src="..\K4AdotNet\bin\Release\netstandard2.0\K4AdotNet.pdb" target="lib\netstandard2.0\K4AdotNet.pdb" />
<file src="..\K4AdotNet\bin\Release\netstandard2.0\K4AdotNet.xml" target="lib\netstandard2.0\K4AdotNet.xml" />

<file src="..\externals\OrbbecSDK-K4A-Wrapper\win-x64\depthengine_2_0.dll" target="runtimes\win-x64\native\depthengine_2_0.dll" />
<file src="..\externals\OrbbecSDK-K4A-Wrapper\win-x64\k4a.dll" target="runtimes\win-x64\native\k4a.dll" />
<file src="..\externals\OrbbecSDK-K4A-Wrapper\win-x64\k4arecord.dll" target="runtimes\win-x64\native\k4arecord.dll" />
<file src="..\externals\OrbbecSDK-K4A-Wrapper\win-x64\OrbbecSDK.dll" target="runtimes\win-x64\native\OrbbecSDK.dll" />

<file src="..\externals\Microsoft.VC141.CRT\x64\msvcp140.dll" target="runtimes\win-x64\native\msvcp140.dll" />
<file src="..\externals\Microsoft.VC141.CRT\x64\vcomp140.dll" target="runtimes\win-x64\native\vcomp140.dll" />
<file src="..\externals\Microsoft.VC141.CRT\x64\vcruntime140.dll" target="runtimes\win-x64\native\vcruntime140.dll" />
<file src="..\externals\Microsoft.VC141.CRT\x64\vcruntime140_1.dll" target="runtimes\win-x64\native\vcruntime140_1.dll" />
</files>
</package>
9 changes: 9 additions & 0 deletions package/k4adotnet-femto.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition="'$(Platform)' == 'x64' OR '$(Platform)' == 'AnyCPU'">
<Content Include="$(MSBuildThisFileDirectory)../runtimes/win-x64/native/*.dll">
<Link>%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</Content>
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions package/k4adotnet.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>K4AdotNet</id>
<version>1.4.14</version>
<version>1.4.15</version>
<authors>bibigone,baSSiLL</authors>
<owners></owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<projectUrl>https://github.com/bibigone/k4a.net/blob/master/README.md</projectUrl>
<iconUrl>https://github.com/bibigone/k4a.net/raw/master/K4AdotNet-64.png</iconUrl>
<description>Three-in-one .NET library to work with Azure Kinect devices. It includes sensor API, recording and playback API, body tracking API. Compatible with .NET Standard 2.0 and .NET Framework 4.6.1 and later. All required binaries from Azure Kinect Sensor SDK (win x64) are included. Samples (WPF, .NET Core and Unity) can be found in the source repository.</description>
<description>Three-in-one .NET library to work with Azure Kinect depth sensors. It includes sensor API, recording and playback API, body tracking API. Compatible with .NET Standard 2.0 and .Net Framework 4.6.1 and later, .NET 6 and later. All required binaries from Azure Kinect Sensor SDK (win x64, x86) are included. Samples (WPF, .NET Core and Unity) can be found in the source repository.</description>
<releaseNotes>See https://github.com/bibigone/k4a.net/releases</releaseNotes>
<copyright>Copyright (c) 2019-2023</copyright>
<copyright>Copyright (c) 2019-2024</copyright>
<tags>Kinect Azure .NET K4A Depth Sensor Body Tracking BodyTracking SDK</tags>
<dependencies>
<group targetFramework=".NETFramework4.6.1" />
Expand Down

0 comments on commit 8fd8149

Please sign in to comment.