Skip to content

Commit

Permalink
Switching to v.1.10.1 of Orbbec SDK K4A Wrapper. Plus minor improveme…
Browse files Browse the repository at this point in the history
…nts and preparations to release v.1.4.17
  • Loading branch information
bibigone committed May 20, 2024
1 parent 0703ff6 commit d3fda18
Show file tree
Hide file tree
Showing 15 changed files with 2,513 additions and 36 deletions.
13 changes: 12 additions & 1 deletion K4AdotNet.Samples.Wpf.BodyTracker/BackgroundTrackingLoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,18 @@ public void Dispose()
public event EventHandler<FailedEventArgs>? Failed;

public void Enqueue(Capture capture)
=> tracker.EnqueueCapture(capture);
{
// Body tracking needs IR and Depth images in capture
using var irImage = capture.IRImage;
if (irImage is null)
return;

using var depthImage = capture.DepthImage;
if (depthImage is null)
return;

tracker.EnqueueCapture(capture);
}

private void BackgroundLoop()
{
Expand Down
2 changes: 1 addition & 1 deletion K4AdotNet.Samples.Wpf.Common/BackgroundReadingLoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public override void GetCalibration(out Calibration calibration)
=> device.GetCalibration(DepthMode, ColorResolution, out calibration);

public override string ToString()
=> device.ToString();
=> device?.ToString() ?? string.Empty;

protected override void BackgroundLoop()
{
Expand Down
2 changes: 1 addition & 1 deletion K4AdotNet.Samples.Wpf.Common/ImageVisualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public bool Update(Image? image, Image? bodyIndexMap = null)
ResetInnerBodyIndexBuffer();

// 2nd step: we can update WritableBitmap only from its owner thread (as a rule, UI thread)
Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(FillWritableBitmap));
Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(FillWritableBitmap));

// Updated
return true;
Expand Down
4 changes: 4 additions & 0 deletions K4AdotNet/K4AdotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
</ItemGroup>

<ItemGroup Condition="'$(Platform)' == 'x64' And $(DefineConstants.Contains(ORBBECSDK_K4A_WRAPPER))">
<Content Include="..\externals\OrbbecSDK-K4A-Wrapper\OrbbecSDKConfig_v1.0.xml" Link="OrbbecSDKConfig_v1.0.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</Content>
<Content Include="..\externals\OrbbecSDK-K4A-Wrapper\win-x64\OrbbecSDK.dll" Link="OrbbecSDK.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
Expand Down
30 changes: 20 additions & 10 deletions K4AdotNet/Sensor/Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,45 +74,55 @@ public bool IsConnected
#endif

/// <summary>Gets the device jack status for the synchronization in connectors.</summary>
/// <remarks>
/// <remarks><para>For Azure Kinect devices:
/// If <see cref="IsSyncInConnected"/> is <see langword="true"/> then
/// <see cref="DeviceConfiguration.WiredSyncMode"/> mode can be set to <see cref="WiredSyncMode.Standalone"/> or <see cref="WiredSyncMode.Subordinate"/>.
/// </remarks>
/// </para><para>
/// For Orbbec Femto devices: Orbbec cameras must preset the synchronization mode in advance, which can be achieved through k4aviewer advance preset,
/// this synchronization mode is implemented using the mapping Orbbec SDK synchronization mode.
/// </para></remarks>
/// <exception cref="ObjectDisposedException">This property cannot be asked for disposed objects.</exception>
/// <exception cref="DeviceConnectionLostException">Connection with device has been lost.</exception>
/// <exception cref="InvalidOperationException">Some unspecified error in Sensor SDK. See logs for details.</exception>
#if ORBBECSDK_K4A_WRAPPER
[Obsolete("Not supported by OrbbecSDK-K4A-Wrapper")]
#endif
public bool IsSyncInConnected
{
get
{
#if ORBBECSDK_K4A_WRAPPER
// Inspired by the latest changes in k4a.hpp (`device` class)
return WiredSyncMode == WiredSyncMode.Subordinate;
#else
CheckResult(NativeApi.DeviceGetSyncJack(handle.ValueNotDisposed, out var syncInConnectedFlag, out _));
return syncInConnectedFlag != 0;
#endif
}
}

/// <summary>Gets the device jack status for the synchronization out connectors.</summary>
/// <remarks>
/// <remarks><para>For Azure Kinect devices:
/// If <see cref="IsSyncOutConnected"/> is <see langword="true"/> then
/// <see cref="DeviceConfiguration.WiredSyncMode"/> mode can be set to <see cref="WiredSyncMode.Standalone"/> or <see cref="WiredSyncMode.Master"/>.
/// If <see cref="IsSyncInConnected"/> is also <see langword="true"/> then
/// <see cref="DeviceConfiguration.WiredSyncMode"/> mode can be set to <see cref="WiredSyncMode.Subordinate"/> (in this case 'Sync Out' is driven for the
/// next device in the chain).
/// </remarks>
/// </para><para>
/// For Orbbec Femto devices: Orbbec cameras must preset the synchronization mode in advance, which can be achieved through k4aviewer advance preset,
/// this synchronization mode is implemented using the mapping Orbbec SDK synchronization mode.
/// </para></remarks>
/// <exception cref="ObjectDisposedException">This property cannot be asked for disposed objects.</exception>
/// <exception cref="DeviceConnectionLostException">Connection with device has been lost.</exception>
/// <exception cref="InvalidOperationException">Some unspecified error in Sensor SDK. See logs for details.</exception>
#if ORBBECSDK_K4A_WRAPPER
[Obsolete("Not supported by OrbbecSDK-K4A-Wrapper")]
#endif
public bool IsSyncOutConnected
{
get
{
#if ORBBECSDK_K4A_WRAPPER
// Inspired by the latest changes in k4a.hpp (`device` class)
return WiredSyncMode == WiredSyncMode.Master;
#else
CheckResult(NativeApi.DeviceGetSyncJack(handle.ValueNotDisposed, out _, out var syncOutConnectedFlag));
return syncOutConnectedFlag != 0;
#endif
}
}

Expand Down
4 changes: 2 additions & 2 deletions Product.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<AssemblyVersion>1.4.16.0</AssemblyVersion>
<FileVersion>1.4.16.0</FileVersion>
<AssemblyVersion>1.4.17.0</AssemblyVersion>
<FileVersion>1.4.17.0</FileVersion>
</PropertyGroup>
<!-- To build version for Orbbec Femto devices, ORBBECSDK_K4A_WRAPPER constant should be defined -->
<!-- Add /p:Devices=Femto to arguments of MSBuild to build version for Orbbec Femto devices -->
Expand Down
Loading

0 comments on commit d3fda18

Please sign in to comment.