public BodyFrame PopFrame(int timeoutInMS = -1) { lock (this) { if (this.disposedValue) { throw new ObjectDisposedException(nameof(BodyTracker)); } NativeMethods.k4a_wait_result_t result = NativeMethods.k4abt_tracker_pop_result(this.handle, out NativeMethods.k4abt_frame_t frameHandle, timeoutInMS); if (result == NativeMethods.k4a_wait_result_t.K4A_WAIT_RESULT_TIMEOUT) { throw new TimeoutException("Timed out waiting for body frame"); } AzureKinectException.ThrowIfNotSuccess(() => result); if (frameHandle.IsInvalid) { throw new AzureKinectException("k4abt_tracker_pop_result did not return a valid body frame handle"); } return(new BodyFrame(frameHandle)); } }
/// <summary> /// Initializes a new instance of the <see cref="BodyTracker"/> class. /// </summary> /// <param name="calibration"></param> public BodyTracker(Calibration calibration) { AzureKinectException.ThrowIfNotSuccess(() => NativeMethods.k4abt_tracker_create(ref calibration, TrackerConfigDefault, out this.handle)); // Hook the native allocator and register this object. // .Dispose() will be called on this object when the allocator is shut down. Allocator.Singleton.RegisterForDisposal(this); }
public Image(ImageFormat format, int width_pixels, int height_pixels, int stride_bytes) { AzureKinectException.ThrowIfNotSuccess(NativeMethods.k4a_image_create(format, width_pixels, height_pixels, stride_bytes, out this.handle)); }
public Skeleton GetBodySkeleton(uint index) { lock (this) { if (this.disposedValue) { throw new ObjectDisposedException(nameof(BodyTracker)); } Skeleton skeleton = default; AzureKinectException.ThrowIfNotSuccess(() => NativeMethods.k4abt_frame_get_body_skeleton(this.handle, index, out skeleton)); return(skeleton); } }
public void EnqueueCapture(Capture capture, int timeoutInMS = -1) { lock (this) { if (disposedValue) { throw new ObjectDisposedException(nameof(Device)); } NativeMethods.k4a_wait_result_t result = BodyTrackingNativeMethods.k4abt_tracker_enqueue_capture(handle, capture.DangerousGetHandle(), timeoutInMS); if (result == NativeMethods.k4a_wait_result_t.K4A_WAIT_RESULT_TIMEOUT) { throw new TimeoutException("Timed out waiting for capture"); } AzureKinectException.ThrowIfNotSuccess(result); } }
public BodyFrame PopResult(int timeoutInMS = -1) { lock (this) { if (disposedValue) { throw new ObjectDisposedException(nameof(Device)); } NativeMethods.k4a_wait_result_t result = BodyTrackingNativeMethods.k4abt_tracker_pop_result(handle, out BodyTrackingNativeMethods.k4abt_frame_t frame, timeoutInMS); if (result == NativeMethods.k4a_wait_result_t.K4A_WAIT_RESULT_TIMEOUT) { throw new TimeoutException("Timed out waiting for capture"); } AzureKinectException.ThrowIfNotSuccess(result); return(new BodyFrame(frame)); } }