diff --git a/src/python/k4a/src/k4a/_bindings/calibration.py b/src/python/k4a/src/k4a/_bindings/calibration.py
index e1b83c7e2..0e09577b4 100644
--- a/src/python/k4a/src/k4a/_bindings/calibration.py
+++ b/src/python/k4a/src/k4a/_bindings/calibration.py
@@ -1,4 +1,4 @@
-'''!
+"""!
@file calibration.py
Defines a Calibration class that is a container for a device calibration.
@@ -6,16 +6,17 @@
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Kinect For Azure SDK.
-'''
+"""
import ctypes as _ctypes
-from .k4atypes import _Calibration, EStatus, EDepthMode, EColorResolution, _Calibration
+from .k4atypes import _Calibration, EStatus, EDepthMode, EColorResolution
from .k4a import k4a_calibration_get_from_raw
+
class Calibration:
- '''! Camera calibration contains intrinsic and extrinsic calibration
+ """! Camera calibration contains intrinsic and extrinsic calibration
information for a camera.
Name | Type | Description
@@ -25,13 +26,13 @@ class Calibration:
resolution_width | int | Resolution width of the calibration sensor.
resolution_height | int | Resolution height of the calibration sensor.
metric_radius | float | Max FOV of the camera.
- '''
-
- def __init__(self, _calibration:_Calibration=None):
+ """
+
+ def __init__(self, _calibration: _Calibration = None):
self._calibration = _calibration
if self._calibration is None:
self._calibration = _Calibration()
-
+
# Allow "with" syntax.
def __enter__(self):
return self
@@ -45,24 +46,24 @@ def __str__(self):
@staticmethod
def create_from_raw(
- raw_calibration:bytearray,
- depth_mode:EDepthMode,
- color_resolution:EColorResolution):
- '''! Get the camera calibration for a device from a raw calibration blob.
+ raw_calibration: bytearray,
+ depth_mode: EDepthMode,
+ color_resolution: EColorResolution):
+ """! Get the camera calibration for a device from a raw calibration blob.
- @param raw_calibration (bytearray): Raw calibration blob obtained from
+ @param raw_calibration: (bytearray): Raw calibration blob obtained from
a device or recording. The raw calibration must be NULL terminated.
- @param depth_mode (EDepthMode): Mode in which depth camera is operated.
+ @param depth_mode: (EDepthMode): Mode in which depth camera is operated.
- @param color_resolution (EColorResolution): Resolution in which color
+ @param color_resolution: (EColorResolution): Resolution in which color
camera is operated.
@returns Calibration: A Calibration instance.
@remarks
- The calibration represents the data needed to transform between the
- camera views and is different for each operating @p depth_mode and
+ camera views and is different for each operating @p depth_mode and
@p color_resolution the device is configured to operate in.
@remarks
@@ -74,14 +75,14 @@ def create_from_raw(
@remarks
- This function is equivalent to Device.get_calibration() function.
Both functions return the same calibration data.
- '''
+ """
calibration = None
# Get the _Calibration struct from the raw buffer.
if (isinstance(raw_calibration, bytearray) and
- isinstance(depth_mode, EDepthMode) and
- isinstance(color_resolution, EColorResolution)):
+ isinstance(depth_mode, EDepthMode) and
+ isinstance(color_resolution, EColorResolution)):
buffer_size_bytes = _ctypes.c_size_t(len(raw_calibration))
cbuffer = (_ctypes.c_uint8 * buffer_size_bytes.value).from_buffer(raw_calibration)
@@ -102,7 +103,7 @@ def create_from_raw(
return calibration
# Define properties and get/set functions. ###############
-
+
@property
def depth_cam_cal(self):
return self._calibration.depth_camera_calibration
@@ -110,7 +111,7 @@ def depth_cam_cal(self):
@property
def color_cam_cal(self):
return self._calibration.color_camera_calibration
-
+
@property
def extrinsics(self):
return self._calibration.extrinsics
@@ -123,4 +124,4 @@ def depth_mode(self):
def color_resolution(self):
return self._calibration.color_resolution
- # ###############
\ No newline at end of file
+ # ###############
diff --git a/src/python/k4a/src/k4a/_bindings/capture.py b/src/python/k4a/src/k4a/_bindings/capture.py
index 468336c7b..4f547ecac 100644
--- a/src/python/k4a/src/k4a/_bindings/capture.py
+++ b/src/python/k4a/src/k4a/_bindings/capture.py
@@ -1,4 +1,4 @@
-'''!
+"""!
@file capture.py
Defines a Capture class that is a container for a single capture of data
@@ -7,7 +7,7 @@
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Kinect For Azure SDK.
-'''
+"""
import ctypes as _ctypes
import copy as _copy
@@ -23,8 +23,9 @@
from .image import Image
+
class Capture:
- '''! A class that represents a capture from an Azure Kinect device.
+ """! A class that represents a capture from an Azure Kinect device.
Property Name | Type | R/W | Description
------------- | ----- | --- | -----------------------------------------
@@ -33,44 +34,44 @@ class Capture:
ir | Image | R/W | The IR image container.
temperature | float | R/W | The temperature
- @remarks
- - A capture represents a set of images that were captured by a
+ @remarks
+ - A capture represents a set of images that were captured by a
device at approximately the same time. A capture may have a color, IR,
- and depth image. A capture may have up to one image of each type. A
+ and depth image. A capture may have up to one image of each type. A
capture may have no image for a given type as well.
-
- @remarks
+
+ @remarks
- Do not use the Capture() constructor to get a Capture instance. It
will return an object that does not have a handle to the capture
resources held by the SDK. Instead, use the create() function.
- @remarks
- - Captures also store a temperature value which represents the
+ @remarks
+ - Captures also store a temperature value which represents the
temperature of the device at the time of the capture.
- @remarks
+ @remarks
- While all the images associated with the capture were collected at
- approximately the same time, each image has an individual timestamp
- which may differ from each other. If the device was configured to
- capture depth and color images separated by a delay,
- Device.get_capture() will return a capture containing both image types
+ approximately the same time, each image has an individual timestamp
+ which may differ from each other. If the device was configured to
+ capture depth and color images separated by a delay,
+ Device.get_capture() will return a capture containing both image types
separated by the configured delay.
- @remarks
+ @remarks
- Empty captures are created with create().
- @remarks
+ @remarks
- Captures can be obtained from a Device object using get_capture().
- @remarks
+ @remarks
- A Capture object may be copied or deep copied. A shallow copy
shares the same images as the original, and any changes in one will
affect the other. A deep copy does not share any resources with the
original, and changes in one will not affect the other. In both shallow
and deep copies, deleting one will have no effects on the other.
- '''
+ """
- def __init__(self, capture_handle:_CaptureHandle):
+ def __init__(self, capture_handle: _CaptureHandle):
self._capture_handle = capture_handle
self._color = None
self._depth = None
@@ -79,13 +80,13 @@ def __init__(self, capture_handle:_CaptureHandle):
@staticmethod
def create():
- '''! Create an empty capture object.
-
+ """! Create an empty capture object.
+
@returns Capture instance with empty contents.
-
- @remarks
+
+ @remarks
- If unsuccessful, None is returned.
- '''
+ """
capture = None
@@ -105,7 +106,7 @@ def _reference(self):
k4a_capture_reference(self._capture_handle)
def __copy__(self):
- # Create a shallow copy.
+ # Create a shallow copy.
new_capture = Capture(self._capture_handle)
new_capture.color = _copy.copy(self.color)
new_capture.depth = _copy.copy(self.depth)
@@ -118,7 +119,7 @@ def __copy__(self):
return new_capture
def __deepcopy__(self, memo):
-
+
# Create a new capture.
new_capture = Capture.create()
@@ -132,7 +133,7 @@ def __deepcopy__(self, memo):
# Since it is a completely different capture, there is no need to
# increment the reference count. Just return the deep copy.
return new_capture
-
+
def __enter__(self):
return self
@@ -176,12 +177,12 @@ def color(self):
return self._color
@color.setter
- def color(self, image:Image):
+ def color(self, image: Image):
if image is not None and isinstance(image, Image):
del self._color
k4a_capture_set_color_image(
- self._capture_handle,
+ self._capture_handle,
image._image_handle)
self._color = image
@@ -199,12 +200,12 @@ def depth(self):
return self._depth
@depth.setter
- def depth(self, image:Image):
+ def depth(self, image: Image):
if image is not None and isinstance(image, Image):
del self._depth
k4a_capture_set_depth_image(
- self._capture_handle,
+ self._capture_handle,
image._image_handle)
self._depth = image
@@ -222,12 +223,12 @@ def ir(self):
return self._ir
@ir.setter
- def ir(self, image:Image):
+ def ir(self, image: Image):
if image is not None and isinstance(image, Image):
del self._ir
k4a_capture_set_ir_image(
- self._capture_handle,
+ self._capture_handle,
image._image_handle)
self._ir = image
@@ -242,12 +243,12 @@ def temperature(self):
return self._temperature
@temperature.setter
- def temperature(self, temperature:float):
+ def temperature(self, temperature: float):
if temperature is not None and isinstance(temperature, float):
del self._temperature
k4a_capture_set_temperature_c(
- self._capture_handle,
+ self._capture_handle,
_ctypes.c_float(temperature))
self._temperature = temperature
@@ -255,4 +256,4 @@ def temperature(self, temperature:float):
@temperature.deleter
def temperature(self):
del self._temperature
- # ###############
\ No newline at end of file
+ # ###############
diff --git a/src/python/k4a/src/k4a/_bindings/device.py b/src/python/k4a/src/k4a/_bindings/device.py
index db65169d9..221f5681b 100644
--- a/src/python/k4a/src/k4a/_bindings/device.py
+++ b/src/python/k4a/src/k4a/_bindings/device.py
@@ -1,4 +1,4 @@
-'''!
+"""!
@file device.py
Defines a Device class that opens a connection to an Azure Kinect device
@@ -13,24 +13,24 @@
This documentation describes the Python API usage for the Azure Kinect Sensor
SDK.
-For details about the Azure Kinect DK hardware and for more information about
+For details about the Azure Kinect DK hardware and for more information about
getting started with development please see https://azure.com/kinect.
@section api_languages API Languages
The Azure Kinect Sensor SDK is primarily a C API. This documentation covers the
Python wrapper extension to the API. For the most detailed documentation of API
-behavior, see the documentation for the C functions that the Python classes
+behavior, see the documentation for the C functions that the Python classes
wrap.
@section python_examples Examples
-Refer to the Examples for example Python code to effectively use the Python
+Refer to the Examples for example Python code to effectively use the Python
API. Once the Python API package is installed, a simple "import k4a" will
give you access to all the classes and enums used in the API.
@example the_basics.py
@example image_transformations.py
@example simple_viewer.py
-'''
+"""
import ctypes as _ctypes
from os import linesep as _newline
@@ -38,7 +38,7 @@
from .k4atypes import _DeviceHandle, HardwareVersion, EStatus, EBufferStatus, \
_EmptyClass, EColorControlCommand, EColorControlMode, ImuSample, \
EWaitStatus, DeviceConfiguration, _CaptureHandle, EDepthMode, EColorResolution, \
- _Calibration, ImuSample
+ _Calibration
from .k4a import k4a_device_get_installed_count, k4a_device_open, \
k4a_device_get_serialnum, k4a_device_get_version, \
@@ -53,14 +53,13 @@
from .calibration import Calibration
-def _read_sync_jack_helper(device_handle:_DeviceHandle)->(bool, bool):
-
+def _read_sync_jack_helper(device_handle: _DeviceHandle) -> (bool, bool):
retval = (False, False)
-
+
# Read the sync jack.
- sync_in = _ctypes.c_bool(0)
- sync_out = _ctypes.c_bool(0)
-
+ sync_in = _ctypes.c_bool(False)
+ sync_out = _ctypes.c_bool(False)
+
status = k4a_device_get_sync_jack(
device_handle,
_ctypes.byref(sync_in),
@@ -74,7 +73,7 @@ def _read_sync_jack_helper(device_handle:_DeviceHandle)->(bool, bool):
class Device:
- '''! A class that represents a connected Azure Kinect device.
+ """! A class that represents a connected Azure Kinect device.
Property Name | Type | R/W | Description
------------------ | ---- | --- | -----------------------------------------
@@ -84,19 +83,20 @@ class Device:
sync_out_connected | bool | R | True if the sync out is connected.
sync_in_connected | bool | R | True if the sync in is connected.
- @remarks
- - Use the static factory function open() to get a connected
+ @remarks
+ - Use the static factory function open() to get a connected
Device instance.
-
- @remarks
+
+ @remarks
- Do not use the Device() constructor to get a Device instance. It
will return an object that is not connected to any device. Calling
open() on that object will fail.
- '''
+ """
_MAX_SERIAL_NUM_LENGTH = 32
- def __init__(self, device_index:int=0):
+ def __init__(self, device_index: int = 0):
+ self.device_index = device_index
self.__device_handle = None
self._serial_number = None
self._hardware_version = None
@@ -115,7 +115,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
# Prevent copying of a device handle.
def __copy__(self):
pass
-
+
# Prevent deep copying of a device handle.
def __deepcopy__(self, src):
pass
@@ -153,33 +153,33 @@ def __str__(self):
self._sync_in_connected)
@staticmethod
- def get_device_count()->int:
- '''! Gets the number of connected devices.
+ def get_device_count() -> int:
+ """! Gets the number of connected devices.
@returns Number of sensors connected to the PC.
- @remarks
+ @remarks
- This API counts the number of Azure Kinect devices connected
to the host PC.
- '''
+ """
return k4a_device_get_installed_count()
@staticmethod
- def open(device_index:int=0):
- '''! Open an Azure Kinect device.
-
- @param device_index (int, optional): The index of the device to open,
+ def open(device_index: int = 0):
+ """! Open an Azure Kinect device.
+
+ @param device_index: (int, optional): The index of the device to open,
starting with 0. Default value is 0.
-
+
@returns An instance of a Device class that has an open connection to the
physical device. This instance grants exclusive access to the device.
-
- @remarks
+
+ @remarks
- If unsuccessful, None is returned.
-
- @remarks
+
+ @remarks
- When done with the device, close the device with close().
- '''
+ """
device = Device()
device.__device_handle = _DeviceHandle()
device._serial_number = None
@@ -188,7 +188,7 @@ def open(device_index:int=0):
# Open device and save device handle.
status = k4a_device_open(
- device_index,
+ device_index,
_ctypes.byref(device.__device_handle))
if status != EStatus.SUCCEEDED:
@@ -199,17 +199,17 @@ def open(device_index:int=0):
serial_number_size = _ctypes.c_size_t(Device._MAX_SERIAL_NUM_LENGTH)
serial_number_buffer = _ctypes.create_string_buffer(
Device._MAX_SERIAL_NUM_LENGTH)
-
+
status_buffer = k4a_device_get_serialnum(
device.__device_handle,
serial_number_buffer,
_ctypes.byref(serial_number_size))
-
+
if status_buffer == EBufferStatus.SUCCEEDED:
device._serial_number = str(serial_number_buffer.value)
else:
device._serial_number = str('')
-
+
# Get hardware version.
status = k4a_device_get_version(
device.__device_handle,
@@ -250,7 +250,7 @@ def open(device_index:int=0):
_ctypes.byref(default_value),
_ctypes.byref(color_control_mode))
- if (status == EStatus.SUCCEEDED):
+ if status == EStatus.SUCCEEDED:
device._color_ctrl_cap.__dict__[command] = _EmptyClass()
device._color_ctrl_cap.__dict__[command].supports_auto = bool(supports_auto.value)
device._color_ctrl_cap.__dict__[command].min_value = int(min_value.value)
@@ -258,7 +258,7 @@ def open(device_index:int=0):
device._color_ctrl_cap.__dict__[command].step_value = int(step_value.value)
device._color_ctrl_cap.__dict__[command].default_value = int(default_value.value)
device._color_ctrl_cap.__dict__[command].default_mode = EColorControlMode(color_control_mode.value)
-
+
# Read the sync jack.
(device._sync_in_connected, device._sync_out_connected) = \
_read_sync_jack_helper(device.__device_handle)
@@ -266,15 +266,15 @@ def open(device_index:int=0):
return device
def close(self):
- '''! Closes an Azure Kinect device.
+ """! Closes an Azure Kinect device.
- @remarks
+ @remarks
- Once closed, the Device object is no longer valid.
- @remarks
+ @remarks
- Before deleting a Device object, ensure that all Captures have
been deleted to ensure that all memory is freed.
- '''
+ """
if self.__device_handle is None:
return
@@ -284,49 +284,49 @@ def close(self):
del self.__device_handle
self.__device_handle = None
- def get_capture(self, timeout_ms:int)->Capture:
- '''! Reads a sensor capture.
+ def get_capture(self, timeout_ms: int) -> Capture:
+ """! Reads a sensor capture.
- @param timeout_ms (int): Specifies the time in milliseconds the
+ @param timeout_ms: (int): Specifies the time in milliseconds the
function should block waiting for the capture. If set to 0, the
function will return without blocking. Passing a negative number
will block indefinitely until data is available, the device is
disconnected, or another error occurs.
-
+
@returns An instance of a Capture class that contains image data from
the sensors. If a capture is not available in the configured
@p timeout_ms, then None is returned.
-
- @remarks
- - Gets the next capture in the streamed sequence of captures
+
+ @remarks
+ - Gets the next capture in the streamed sequence of captures
from the camera. If a new capture is not currently available, this
function will block until the timeout is reached. The SDK will
buffer at least two captures worth of data before dropping the
oldest capture. Callers needing to capture all data need to ensure
they read the data as fast as data is being produced on average.
-
- @remarks
+
+ @remarks
- Upon successfully reading a capture this function will return
- a Capture instance. If a capture is not available in the configured
+ a Capture instance. If a capture is not available in the configured
@p timeout_in_ms, then the API will return None.
- @remarks
+ @remarks
- This function needs to be called while the device is in a
- running state; after start_cameras() is called and before
+ running state; after start_cameras() is called and before
stop_cameras() is called.
- @remarks
+ @remarks
- This function returns None when an internal problem is
- encountered, such as loss of the USB connection, inability to
+ encountered, such as loss of the USB connection, inability to
allocate enough memory, and other unexpected issues. Any error
- encountered by this function signals the end of streaming data,
+ encountered by this function signals the end of streaming data,
and caller should stop the stream using stop_cameras().
-
- @remarks
+
+ @remarks
- If this function is waiting for data (non-zero timeout) when
- stop_cameras() or close() is called on another thread, this
+ stop_cameras() or close() is called on another thread, this
function will encounter an error and return None.
- '''
+ """
capture = None
# Get a capture handle.
@@ -342,50 +342,50 @@ def get_capture(self, timeout_ms:int)->Capture:
return capture
- def get_imu_sample(self, timeout_ms:int)->ImuSample:
- '''! Reads an IMU sample.
+ def get_imu_sample(self, timeout_ms: int) -> ImuSample:
+ """! Reads an IMU sample.
- @param timeout_ms (int): Specifies the time in milliseconds the
+ @param timeout_ms: (int): Specifies the time in milliseconds the
function should block waiting for the sample. If set to 0, the
function will return without blocking. Passing a negative number
- will block indefinitely until data is available, the device is
+ will block indefinitely until data is available, the device is
disconnected, or another error occurs.
-
+
@returns An instance of an ImuSample class that contains data from the
IMU. If data is not available in the configured @p timeout_ms, then
None is returned.
- @remarks
+ @remarks
- Gets the next sample in the streamed sequence of IMU samples
- from the device. If a new sample is not currently available, this
- function will block until the timeout is reached. The API will
- buffer at least two camera capture intervals worth of samples
- before dropping the oldest sample. Callers needing to capture all
+ from the device. If a new sample is not currently available, this
+ function will block until the timeout is reached. The API will
+ buffer at least two camera capture intervals worth of samples
+ before dropping the oldest sample. Callers needing to capture all
data need to ensure they read the data as fast as the data is being
produced on average.
-
- @remarks
- - Upon successfully reading a sample this function will return
- an ImuSample. If a sample is not available in the configured
+
+ @remarks
+ - Upon successfully reading a sample this function will return
+ an ImuSample. If a sample is not available in the configured
@p timeout_ms, then the API will return None.
-
- @remarks
+
+ @remarks
- This function needs to be called while the device is in a
- running state; after start_imu() is called and before stop_imu() is
+ running state; after start_imu() is called and before stop_imu() is
called.
-
- @remarks
+
+ @remarks
- This function returns None when an internal problem is
encountered, such as loss of the USB connection, inability to
allocate enough memory, and other unexpected issues. Any error
- returned by this function signals the end of streaming data, and
+ returned by this function signals the end of streaming data, and
the caller should stop the stream using stop_imu().
-
- @remarks
+
+ @remarks
- If this function is waiting for data (non-zero timeout) when
stop_imu() or close() is called on another thread, this function
will encounter an error and return None.
- '''
+ """
imu_sample = ImuSample()
wait_status = k4a_device_get_imu_sample(
@@ -399,10 +399,10 @@ def get_imu_sample(self, timeout_ms:int)->ImuSample:
return imu_sample
- def start_cameras(self, device_config:DeviceConfiguration)->EStatus:
- '''! Starts color and depth camera capture.
+ def start_cameras(self, device_config: DeviceConfiguration) -> EStatus:
+ """! Starts color and depth camera capture.
- @param device_config (DeviceConfiguration): The configuration to run
+ @param device_config: (DeviceConfiguration): The configuration to run
the device in. See DeviceConfiguration for the definition of
the device configuration accepted by this function.
@@ -417,15 +417,15 @@ def start_cameras(self, device_config:DeviceConfiguration)->EStatus:
same device until stop_cameras() has been called.
@see DeviceConfiguration, stop_cameras
- '''
+ """
status = k4a_device_start_cameras(
self.__device_handle,
_ctypes.byref(device_config))
-
+
return status
def stop_cameras(self):
- '''! Stops the color and depth camera capture.
+ """! Stops the color and depth camera capture.
@remarks
- The streaming of individual sensors stops as a result of this
@@ -434,58 +434,58 @@ def stop_cameras(self):
@remarks
- This function may be called while another thread is blocking
- in get_capture(). Calling this function while another thread is in
+ in get_capture(). Calling this function while another thread is in
that function will result in that function returning None.
-
+
@see start_cameras
- '''
+ """
if self.__device_handle is None:
return
k4a_device_stop_cameras(self.__device_handle)
- def start_imu(self)->EStatus:
- '''! Starts the IMU sample stream.
+ def start_imu(self) -> EStatus:
+ """! Starts the IMU sample stream.
@returns EStatus: EStatus.SUCCEEDED is returned on success, and
EStatus.FAILED is returned otherwise.
@remarks
- Call this API to start streaming IMU data. It is not valid
- to call this function a second time on the same Device until
+ to call this function a second time on the same Device until
stop_imu() has been called.
@remarks
- This function is dependent on the state of the cameras. The
- color or depth camera must be started before the IMU.
+ color or depth camera must be started before the IMU.
EStatus.FAILED will be returned if neither of the cameras is
running.
- '''
+ """
return k4a_device_start_imu(self.__device_handle)
def stop_imu(self):
- '''! Stops the IMU capture.
+ """! Stops the IMU capture.
@remarks
- - The streaming of the IMU stops as a result of this call.
- Once called, start_imu() may be called again to resume sensor
+ - The streaming of the IMU stops as a result of this call.
+ Once called, start_imu() may be called again to resume sensor
streaming, so long as the cameras are running.
@remarks
- This function may be called while another thread is blocking
in get_imu_sample(). Calling this function while another thread is
in that function will result in that function returning a failure.
- '''
+ """
if self.__device_handle is None:
return
k4a_device_stop_imu(self.__device_handle)
- def get_color_control(self,
- color_ctrl_command:EColorControlCommand)->(int, EColorControlMode):
- '''! Get the Azure Kinect color sensor control.
+ def get_color_control(self,
+ color_ctrl_command: EColorControlCommand) -> (int, EColorControlMode):
+ """! Get the Azure Kinect color sensor control.
- @param color_ctrl_command (EColorControlCommand): Color sensor control
+ @param color_ctrl_command: (EColorControlCommand): Color sensor control
command.
@returns (int, EColorControlMode): A tuple where the first element is
@@ -493,35 +493,35 @@ def get_color_control(self,
element is the EColorControlMode that represents whether the
command is in automatic or manual mode.
- @remarks
+ @remarks
- The returned value is always written but is only valid when
the returned EColorControlMode is EColorControlMode.MANUAL.
- @remarks
- - Each control command may be set to manual or automatic. See
+ @remarks
+ - Each control command may be set to manual or automatic. See
the definition of EColorControlCommand on how to interpret the
value for each command.
- @remarks
+ @remarks
- Some control commands are only supported in manual mode. When
- a command is in automatic mode, the value for that command is not
+ a command is in automatic mode, the value for that command is not
valid.
- @remarks
+ @remarks
- Control values set on a device are reset only when the device
- is power cycled. The device will retain the settings even if the
+ is power cycled. The device will retain the settings even if the
device closed or the application is restarted. See the Device
instance's color_ctrl_cap property for default values of the color
control.
- '''
+ """
retval = None
retmode = None
color_ctrl_value = _ctypes.c_int32(0)
- command = _ctypes.c_int(color_ctrl_command.value)
+ # command = _ctypes.c_int(color_ctrl_command.value)
mode = _ctypes.c_int32(EColorControlMode.MANUAL.value)
-
+
status = k4a_device_get_color_control(
self.__device_handle,
color_ctrl_command,
@@ -532,33 +532,33 @@ def get_color_control(self,
retval = color_ctrl_value.value
retmode = EColorControlMode(mode.value)
- return (retval, retmode)
+ return retval, retmode
def set_color_control(
- self,
- color_ctrl_command:EColorControlCommand,
- color_ctrl_mode:EColorControlMode,
- color_ctrl_value:int)->EStatus:
- '''! Set the Azure Kinect color sensor control value.
+ self,
+ color_ctrl_command: EColorControlCommand,
+ color_ctrl_mode: EColorControlMode,
+ color_ctrl_value: int) -> EStatus:
+ """! Set the Azure Kinect color sensor control value.
- @param color_ctrl_command (EColorControlCommand): Color sensor control
+ @param color_ctrl_command: (EColorControlCommand): Color sensor control
command to set.
- @param color_ctrl_mode (EColorControlMode): Color sensor control mode
+ @param color_ctrl_mode: (EColorControlMode): Color sensor control mode
to set. This mode represents whether the command is in automatic
or manual mode.
- @param color_ctrl_value (int): The value to set the color sensor
+ @param color_ctrl_value: (int): The value to set the color sensor
control. The value is only valid if @p color_ctrl_mode is set to
EColorControlMode.MANUAL, and is otherwise ignored.
@returns EStatus.SUCCEEDED if successful, EStatus.FAILED otherwise.
- @remarks
- - Each control command may be set to manual or automatic. See
+ @remarks
+ - Each control command may be set to manual or automatic. See
the definition of EColorControlCommand on how to interpret the
@p value for each command.
- '''
+ """
value = _ctypes.c_int32(color_ctrl_value)
command = _ctypes.c_int(color_ctrl_command.value)
@@ -572,20 +572,20 @@ def set_color_control(
return status
- def get_raw_calibration(self)->bytearray:
- '''! Get the raw calibration blob for the entire Azure Kinect device.
+ def get_raw_calibration(self) -> bytearray:
+ """! Get the raw calibration blob for the entire Azure Kinect device.
@returns bytearray: A byte array containing the raw calibration data.
If this function fails to get the raw calibration data, then None
is returned.
- @remarks
+ @remarks
- If this function fails to get the raw calibration data, then
None is returned.
@see Calibration
- '''
- buffer = None
+ """
+ buffer = bytearray()
# Get the size in bytes of the buffer that is required to
# hold the raw calibration data.
@@ -596,7 +596,7 @@ def get_raw_calibration(self)->bytearray:
self.__device_handle,
_ctypes.byref(buffer_ptr),
_ctypes.byref(buffer_size_bytes))
-
+
if status != EBufferStatus.BUFFER_TOO_SMALL:
return buffer
@@ -614,19 +614,19 @@ def get_raw_calibration(self)->bytearray:
if status != EBufferStatus.SUCCEEDED:
buffer = None
-
+
return buffer
def get_calibration(self,
- depth_mode:EDepthMode,
- color_resolution:EColorResolution)->Calibration:
- '''! Get the camera calibration for the entire Azure Kinect device for
+ depth_mode: EDepthMode,
+ color_resolution: EColorResolution) -> Calibration:
+ """! Get the camera calibration for the entire Azure Kinect device for
a specific depth mode and color resolution.
- @param depth_mode (EDepthMode): The mode in which the depth camera is
+ @param depth_mode: (EDepthMode): The mode in which the depth camera is
operated.
- @param color_resolution (EColorResolution): The resolution in which the
+ @param color_resolution: (EColorResolution): The resolution in which the
color camera is operated.
@returns Calibration: A Calibration instance containing the calibration
@@ -634,16 +634,16 @@ def get_calibration(self,
this function fails to get the calibration data, then None is
returned.
- @remarks
- - The calibration represents the data needed to transform
- between the camera views and may be different for each operating
- @p depth_mode and @p color_resolution the device is configured to
+ @remarks
+ - The calibration represents the data needed to transform
+ between the camera views and may be different for each operating
+ @p depth_mode and @p color_resolution the device is configured to
operate in.
- @remarks
- - The calibration object is used to instantiate the
+ @remarks
+ - The calibration object is used to instantiate the
Transformation class and functions.
- '''
+ """
calibration = None
if not isinstance(depth_mode, EDepthMode):
diff --git a/src/python/k4a/src/k4a/_bindings/image.py b/src/python/k4a/src/k4a/_bindings/image.py
index d066b325d..752a80802 100644
--- a/src/python/k4a/src/k4a/_bindings/image.py
+++ b/src/python/k4a/src/k4a/_bindings/image.py
@@ -1,4 +1,4 @@
-'''!
+"""!
@file image.py
Defines an Image class that is a container for a single image
@@ -7,17 +7,16 @@
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Kinect For Azure SDK.
-'''
+"""
import ctypes as _ctypes
import numpy as _np
-import copy as _copy
from .k4atypes import _ImageHandle, EStatus, EImageFormat
from .k4a import k4a_image_create, k4a_image_create_from_buffer, \
k4a_image_release, k4a_image_get_buffer, \
- k4a_image_reference, k4a_image_release, k4a_image_get_format, \
+ k4a_image_reference, k4a_image_get_format, \
k4a_image_get_size, k4a_image_get_width_pixels, \
k4a_image_get_height_pixels, k4a_image_get_stride_bytes, \
k4a_image_get_device_timestamp_usec, k4a_image_set_device_timestamp_usec, \
@@ -26,15 +25,16 @@
k4a_image_get_white_balance, k4a_image_set_white_balance, \
k4a_image_get_iso_speed, k4a_image_set_iso_speed
+
class Image:
- '''! A class that represents an image from an imaging sensor in an
+ """! A class that represents an image from an imaging sensor in an
Azure Kinect device.
Property Name | Type | R/W | Description |
-
+
data |
numpy.ndarray |
@@ -83,7 +83,7 @@ class Image:
R/W |
The device timestamp in microseconds.
- Timestamps are recorded by the device and represent the mid-point of
- exposure. They may be used for relative comparison, but their
+ exposure. They may be used for relative comparison, but their
absolute value has no defined meaning.
- If the Image is invalid or if no timestamp was set for the image,
this value will be 0. It is also possible for a 0 value to be a
@@ -97,19 +97,19 @@ class Image:
| int |
R/W |
The device timestamp in nanoseconds.
- - The system timestamp is a high performance and increasing clock
- (from boot). The timestamp represents the time immediately after
+ - The system timestamp is a high performance and increasing clock
+ (from boot). The timestamp represents the time immediately after
the image buffer was read by the host PC.
- Timestamps are recorded by the host. They may be used for relative
- comparision, as they are relative to the corresponding system
- clock. The absolute value is a monotonic count from an arbitrary
+ comparision, as they are relative to the corresponding system
+ clock. The absolute value is a monotonic count from an arbitrary
point in the past.
- - The system timestamp is captured at the moment host PC finishes
+ - The system timestamp is captured at the moment host PC finishes
receiving the image.
- - On Linux the system timestamp is read from
+ - On Linux the system timestamp is read from
clock_gettime(CLOCK_MONOTONIC), which measures realtime and is not
- impacted by adjustments to the system clock. It starts from an
- arbitrary point in the past. On Windows the system timestamp is
+ impacted by adjustments to the system clock. It starts from an
+ arbitrary point in the past. On Windows the system timestamp is
read from QueryPerformanceCounter(). It also measures realtime and
is not impacted by adjustments to the system clock. It also starts
from an arbitrary point in the past.
@@ -159,55 +159,55 @@ class Image:
|
- @remarks
+ @remarks
- An Image manages an image buffer and associated metadata.
-
- @remarks
+
+ @remarks
- Do not use the Image() constructor to get an Image instance. It
will return an object that does not have a handle to the image
resources held by the SDK. Instead, use the create() function.
- @remarks
+ @remarks
- The memory associated with the image buffer in an Image may have been
- allocated by the Azure Kinect APIs or by the application. If the
+ allocated by the Azure Kinect APIs or by the application. If the
Image was created by an Azure Kinect API, its memory will be freed when all
references to the Image are released. All images retrieved directly from a
device will have been created by the API. An application can create an
Image using memory that it has allocated using create_from_ndarray() and
- passing an numpy ndarray with a pre-allocated memory. In both cases, the
+ passing a numpy ndarray with a pre-allocated memory. In both cases, the
memory is released when the all references to the Image object are
released, either explicitly with del or it goes out of scope. Users do not
need to worry about memory allocation and deallocation other than the
normal rules for Python objects.
@remarks
- - An image has a number of metadata properties that can be set or
- retrieved. Not all properties are applicable to images of all types.
+ - An image has a number of metadata properties that can be set or
+ retrieved. Not all properties are applicable to images of all types.
See the documentation for the individual properties for more information on
their applicability and meaning.
@remarks
- - Images may be of one of the standard EImageFormat formats, or may be of
- format EImageFormat.CUSTOM. The format defines how the underlying image
+ - Images may be of one of the standard EImageFormat formats, or may be of
+ format EImageFormat.CUSTOM. The format defines how the underlying image
buffer should be interpreted.
@remarks
- - Images from a device are retrieved through a Capture object returned by
+ - Images from a device are retrieved through a Capture object returned by
Device.get_capture().
@remarks
- Images stored in a capture are referenced by the capture until they are
replaced or the capture is destroyed.
- @remarks
+ @remarks
- An Image object may be copied or deep copied. A shallow copy
shares the same data as the original, and any changes in one will
affect the other. A deep copy does not share any resources with the
original, and changes in one will not affect the other. In both shallow
and deep copies, deleting one will have no effects on the other.
- '''
+ """
- def __init__(self, image_handle:_ImageHandle=None):
+ def __init__(self, image_handle: _ImageHandle = None):
self.__image_handle = image_handle
# The _data property is a numpy ndarray. The buffer backing the ndarray
@@ -228,10 +228,10 @@ def __init__(self, image_handle:_ImageHandle=None):
@staticmethod
def _get_array_type_from_format(
- image_format:EImageFormat,
- buffer_size:int,
- width_pixels:int,
- height_pixels:int):
+ image_format: EImageFormat,
+ buffer_size: int,
+ width_pixels: int,
+ height_pixels: int):
array_type = None
array_len_bytes = 0
@@ -240,10 +240,10 @@ def _get_array_type_from_format(
array_type = _ctypes.c_ubyte * buffer_size
array_len_bytes = buffer_size
elif image_format == EImageFormat.COLOR_NV12:
- array_type = ((_ctypes.c_ubyte * 1) * width_pixels) * (height_pixels + int(height_pixels/2))
- array_len_bytes = width_pixels * (height_pixels + int(height_pixels/2))
+ array_type = ((_ctypes.c_ubyte * 1) * width_pixels) * (height_pixels + int(height_pixels / 2))
+ array_len_bytes = width_pixels * (height_pixels + int(height_pixels / 2))
elif image_format == EImageFormat.COLOR_YUY2:
- array_type = (_ctypes.c_ubyte * width_pixels*2) * height_pixels
+ array_type = (_ctypes.c_ubyte * width_pixels * 2) * height_pixels
array_len_bytes = width_pixels * height_pixels * 2
elif image_format == EImageFormat.COLOR_BGRA32:
array_type = ((_ctypes.c_ubyte * 4) * width_pixels) * height_pixels
@@ -264,13 +264,13 @@ def _get_array_type_from_format(
array_type = _ctypes.c_ubyte * buffer_size
array_len_bytes = buffer_size
- return (array_type, array_len_bytes)
+ return array_type, array_len_bytes
# This static method should not be called by users.
# It is an internal-only function for instantiating an Image object.
@staticmethod
def _create_from_existing_image_handle(
- image_handle:_ImageHandle):
+ image_handle: _ImageHandle):
# Create an Image object.
image = Image(image_handle=image_handle)
@@ -282,20 +282,20 @@ def _create_from_existing_image_handle(
@staticmethod
def create(
- image_format:EImageFormat,
- width_pixels:int,
- height_pixels:int,
- stride_bytes:int):
- '''! Create an image.
+ image_format: EImageFormat,
+ width_pixels: int,
+ height_pixels: int,
+ stride_bytes: int):
+ """! Create an image.
- @param image_format (EImageFormat): The format of the image that will
+ @param image_format: (EImageFormat): The format of the image that will
be stored in this image container.
- @param width_pixels (int): Width in pixels.
+ @param width_pixels: (int): Width in pixels.
- @param height_pixels (int): Height in pixels.
+ @param height_pixels: (int): Height in pixels.
- @param stride_bytes (int): The number of bytes per horizontal line of
+ @param stride_bytes: (int): The number of bytes per horizontal line of
the image. If set to 0, the stride will be set to the minimum size
given the image format and width_pixels.
@@ -303,7 +303,7 @@ def create(
error occurs, then None is returned.
@remarks
- - This function is used to create images of formats that have
+ - This function is used to create images of formats that have
consistent stride. The function is not suitable for compressed
formats that may not be represented by the same number of bytes per
line.
@@ -311,27 +311,27 @@ def create(
@remarks
- For most image formats, the function will allocate an image buffer of
size @p height_pixels * @p stride_bytes. Buffers with image format
- of EImageFormat.COLOR_NV12 will allocate an additional
- @p height_pixels / 2 set of lines (each of @p stride_bytes). This
+ of EImageFormat.COLOR_NV12 will allocate an additional
+ @p height_pixels / 2 set of lines (each of @p stride_bytes). This
function cannot be used to allocate EImageFormat.COLOR_MJPG buffer.
@remarks
- - To create an image object without the API allocating memory, or to
- represent an image that has a non-deterministic stride, use
+ - To create an image object without the API allocating memory, or to
+ represent an image that has a non-deterministic stride, use
create_from_ndarray().
@remarks
- If an error occurs, then None is returned.
- '''
+ """
image = None
- assert(isinstance(image_format, EImageFormat)), "image_format parameter must be an EImageFormat."
- assert(width_pixels > 0), "width_pixels must be greater than zero."
- assert(height_pixels > 0), "height_pixels must be greater than zero."
- assert(stride_bytes > 0), "stride_bytes must be greater than zero."
- assert(stride_bytes > width_pixels), "stride_bytes must be greater than width_pixels."
- assert(stride_bytes > height_pixels), "stride_bytes must be greater than height_pixels."
+ assert (isinstance(image_format, EImageFormat)), "image_format parameter must be an EImageFormat."
+ assert (width_pixels > 0), "width_pixels must be greater than zero."
+ assert (height_pixels > 0), "height_pixels must be greater than zero."
+ assert (stride_bytes > 0), "stride_bytes must be greater than zero."
+ assert (stride_bytes > width_pixels), "stride_bytes must be greater than width_pixels."
+ assert (stride_bytes > height_pixels), "stride_bytes must be greater than height_pixels."
# Create an image.
image_handle = _ImageHandle()
@@ -349,32 +349,32 @@ def create(
@staticmethod
def create_from_ndarray(
- image_format:EImageFormat,
- arr:_np.ndarray,
- stride_bytes_custom:int=0,
- size_bytes_custom:int=0,
- width_pixels_custom:int=0,
- height_pixels_custom:int=0):
- '''! Create an image from a pre-allocated buffer.
-
- @param image_format (EImageFormat): The format of the image that will
+ image_format: EImageFormat,
+ arr: _np.ndarray,
+ stride_bytes_custom: int = 0,
+ size_bytes_custom: int = 0,
+ width_pixels_custom: int = 0,
+ height_pixels_custom: int = 0):
+ """! Create an image from a pre-allocated buffer.
+
+ @param image_format: (EImageFormat): The format of the image that will
be stored in this image container.
- @param arr (numpy.ndarray): A pre-allocated numpy ndarray.
+ @param arr: (numpy.ndarray): A pre-allocated numpy ndarray.
- @param stride_bytes_custom (int, optional): User-defined stride in bytes.
+ @param stride_bytes_custom: (int, optional): User-defined stride in bytes.
- @param size_bytes_custom (int): User-defined size in bytes of the data.
+ @param size_bytes_custom: (int): User-defined size in bytes of the data.
- @param width_pixels_custom (int): User-defined width in pixels of the data.
+ @param width_pixels_custom: (int): User-defined width in pixels of the data.
- @param height_pixels_custom (int): User-defined height in pixels of the data.
+ @param height_pixels_custom: (int): User-defined height in pixels of the data.
@returns Image: An Image instance using the pre-allocated data buffer. If an
error occurs, then None is returned.
@remarks
- - This function is used to create images of formats that have
+ - This function is used to create images of formats that have
consistent stride. The function is not suitable for compressed
formats that may not be represented by the same number of bytes per
line.
@@ -397,7 +397,7 @@ def create_from_ndarray(
@remarks
- If an error occurs, then None is returned.
- '''
+ """
image = None
assert(isinstance(arr, _nd.ndarray)), "arr must be a numpy ndarray object."
@@ -479,7 +479,7 @@ def __copy__(self):
new_image._stride_bytes = self._stride_bytes
new_image._device_timestamp_usec = self._device_timestamp_usec
new_image._system_timestamp_nsec = self._system_timestamp_nsec
- new_image._exposure_usec =self._exposure_usec
+ new_image._exposure_usec = self._exposure_usec
new_image._white_balance = self._white_balance
new_image._iso_speed = self._iso_speed
@@ -510,7 +510,7 @@ def __deepcopy__(self, memo):
# Do not need to update reference count. Just return the copy.
return new_image
-
+
def __enter__(self):
return self
@@ -549,7 +549,7 @@ def _image_handle(self):
@_image_handle.deleter
def _image_handle(self):
-
+
# Release the image before deleting.
if isinstance(self._data, _np.ndarray):
if not self._data.flags.owndata:
@@ -571,18 +571,18 @@ def data(self):
height_pixels = k4a_image_get_height_pixels(self.__image_handle)
stride_bytes = k4a_image_get_stride_bytes(self.__image_handle)
- assert(buffer_size > 0), "buffer_size must be greater than zero."
- assert(width_pixels > 0), "width_pixels must be greater than zero."
- assert(height_pixels > 0), "height_pixels must be greater than zero."
- assert(stride_bytes > 0), "stride_bytes must be greater than zero."
- assert(stride_bytes > width_pixels), "stride_bytes must be greater than width_pixels."
- assert(stride_bytes > height_pixels), "stride_bytes must be greater than height_pixels."
+ assert (buffer_size > 0), "buffer_size must be greater than zero."
+ assert (width_pixels > 0), "width_pixels must be greater than zero."
+ assert (height_pixels > 0), "height_pixels must be greater than zero."
+ assert (stride_bytes > 0), "stride_bytes must be greater than zero."
+ assert (stride_bytes > width_pixels), "stride_bytes must be greater than width_pixels."
+ assert (stride_bytes > height_pixels), "stride_bytes must be greater than height_pixels."
# Construct a descriptor of the data in the buffer.
(array_type, array_len_bytes) = Image._get_array_type_from_format(
image_format, buffer_size, width_pixels, height_pixels)
- assert(array_type is not None), "Unrecognized image format."
- assert(array_len_bytes <= buffer_size), "ndarray size should be less than buffer size in bytes."
+ assert (array_type is not None), "Unrecognized image format."
+ assert (array_len_bytes <= buffer_size), "ndarray size should be less than buffer size in bytes."
self._data = _np.ctypeslib.as_array(array_type.from_address(
_ctypes.c_void_p.from_buffer(buffer_ptr).value))
@@ -650,9 +650,9 @@ def device_timestamp_usec(self):
return self._device_timestamp_usec
@device_timestamp_usec.setter
- def device_timestamp_usec(self, value:int):
+ def device_timestamp_usec(self, value: int):
k4a_image_set_device_timestamp_usec(
- self.__image_handle,
+ self.__image_handle,
_ctypes.c_ulonglong(value))
self._device_timestamp_usec = value
@@ -667,9 +667,9 @@ def system_timestamp_nsec(self):
return self._system_timestamp_nsec
@system_timestamp_nsec.setter
- def system_timestamp_nsec(self, value:int):
+ def system_timestamp_nsec(self, value: int):
k4a_image_set_system_timestamp_nsec(
- self.__image_handle,
+ self.__image_handle,
_ctypes.c_ulonglong(value))
self._system_timestamp_nsec = value
@@ -684,9 +684,9 @@ def exposure_usec(self):
return self._exposure_usec
@exposure_usec.setter
- def exposure_usec(self, value:int):
+ def exposure_usec(self, value: int):
k4a_image_set_exposure_usec(
- self.__image_handle,
+ self.__image_handle,
_ctypes.c_ulonglong(value))
self._exposure_usec = value
@@ -701,9 +701,9 @@ def white_balance(self):
return self._white_balance
@white_balance.setter
- def white_balance(self, value:int):
+ def white_balance(self, value: int):
k4a_image_set_white_balance(
- self.__image_handle,
+ self.__image_handle,
_ctypes.c_uint32(value))
self._white_balance = value
@@ -718,9 +718,9 @@ def iso_speed(self):
return self._iso_speed
@iso_speed.setter
- def iso_speed(self, value:int):
+ def iso_speed(self, value: int):
k4a_image_set_iso_speed(
- self.__image_handle,
+ self.__image_handle,
_ctypes.c_uint32(value))
self._iso_speed = value
@@ -728,5 +728,5 @@ def iso_speed(self, value:int):
def iso_speed(self):
del self._iso_speed
self._iso_speed = None
-
- # ###############
\ No newline at end of file
+
+ # ###############
diff --git a/src/python/k4a/src/k4a/_bindings/k4a.py b/src/python/k4a/src/k4a/_bindings/k4a.py
index 3746aa353..eb7cd781d 100644
--- a/src/python/k4a/src/k4a/_bindings/k4a.py
+++ b/src/python/k4a/src/k4a/_bindings/k4a.py
@@ -1,7 +1,7 @@
-'''!
+"""!
@file k4a.py
-Defines Python _ctypes equivalent functions to those defined in k4a.h.
+Defines Python _ctypes equivalent functions to those defined in k4a.h.
Credit given to hexops's github contribution for the
_ctypes.Structure definitions and _ctypes function bindings.
@@ -10,8 +10,7 @@
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Kinect For Azure SDK.
-'''
-
+"""
import ctypes as _ctypes
import os.path as _os_path
@@ -23,9 +22,30 @@
_TransformationHandle, _Calibration, _Float2, _Float3, \
_memory_allocate_cb, _memory_destroy_cb
-
-__all__ = []
-
+__all__ = ['k4a_image_create', 'k4a_image_create_from_buffer',
+ 'k4a_image_release', 'k4a_image_get_buffer',
+ 'k4a_image_reference', 'k4a_image_get_format',
+ 'k4a_image_get_size', 'k4a_image_get_width_pixels',
+ 'k4a_image_get_height_pixels', 'k4a_image_get_stride_bytes',
+ 'k4a_image_get_device_timestamp_usec', 'k4a_image_set_device_timestamp_usec',
+ 'k4a_image_get_system_timestamp_nsec', 'k4a_image_set_system_timestamp_nsec',
+ 'k4a_image_get_exposure_usec', 'k4a_image_set_exposure_usec',
+ 'k4a_image_get_white_balance', 'k4a_image_set_white_balance',
+ 'k4a_image_get_iso_speed', 'k4a_image_set_iso_speed', 'k4a_calibration_get_from_raw',
+ 'k4a_capture_create', 'k4a_capture_release', 'k4a_capture_reference',
+ 'k4a_capture_get_color_image', 'k4a_capture_set_color_image',
+ 'k4a_capture_get_depth_image', 'k4a_capture_set_depth_image',
+ 'k4a_capture_get_ir_image', 'k4a_capture_set_ir_image',
+ 'k4a_capture_get_temperature_c', 'k4a_capture_set_temperature_c',
+ 'k4a_device_get_installed_count', 'k4a_device_open',
+ 'k4a_device_get_serialnum', 'k4a_device_get_version',
+ 'k4a_device_get_color_control_capabilities', 'k4a_device_close',
+ 'k4a_device_get_imu_sample', 'k4a_device_get_color_control',
+ 'k4a_device_start_cameras', 'k4a_device_stop_cameras',
+ 'k4a_device_start_imu', 'k4a_device_stop_imu',
+ 'k4a_device_set_color_control', 'k4a_device_get_raw_calibration',
+ 'k4a_device_get_sync_jack', 'k4a_device_get_capture', 'k4a_device_get_calibration'
+ ]
# Load the k4a.dll.
try:
@@ -41,135 +61,114 @@
print("Failed to load library", ee)
_sys.exit(1)
-
# Map _ctypes symbols to functions in the k4a.dll.
-#K4A_EXPORT uint32_t k4a_device_get_installed_count(void);
+# K4A_EXPORT uint32_t k4a_device_get_installed_count(void);
k4a_device_get_installed_count = _k4a_lib.k4a_device_get_installed_count
k4a_device_get_installed_count.restype = _ctypes.c_uint32
k4a_device_get_installed_count.argtypes = None
-
-#K4A_EXPORT k4a_status_t k4a_set_debug_message_handler(logging_message_cb *message_cb,
+# K4A_EXPORT k4a_status_t k4a_set_debug_message_handler(logging_message_cb *message_cb,
# void *message_cb_context,
# k4a_log_level_t min_level);
k4a_set_debug_message_handler = _k4a_lib.k4a_set_debug_message_handler
k4a_set_debug_message_handler.restype = EStatus
k4a_set_debug_message_handler.argtypes = (_ctypes.POINTER(logging_message_cb), _ctypes.c_void_p, _ctypes.c_int)
-
-#K4A_EXPORT k4a_result_t k4a_set_allocator(k4a_memory_allocate_cb_t allocate, k4a_memory_destroy_cb_t free);
+# K4A_EXPORT k4a_result_t k4a_set_allocator(k4a_memory_allocate_cb_t allocate, k4a_memory_destroy_cb_t free);
k4a_set_allocator = _k4a_lib.k4a_set_allocator
k4a_set_allocator.restype = EStatus
k4a_set_allocator.argtypes = (_memory_allocate_cb, _memory_destroy_cb,)
-
-#K4A_EXPORT k4a_status_t k4a_device_open(uint32_t index, k4a_device_t *device_handle);
+# K4A_EXPORT k4a_status_t k4a_device_open(uint32_t index, k4a_device_t *device_handle);
k4a_device_open = _k4a_lib.k4a_device_open
k4a_device_open.restype = EStatus
k4a_device_open.argtypes = (_ctypes.c_uint32, _ctypes.POINTER(_DeviceHandle))
-
-#K4A_EXPORT void k4a_device_close(k4a_device_t device_handle);
+# K4A_EXPORT void k4a_device_close(k4a_device_t device_handle);
k4a_device_close = _k4a_lib.k4a_device_close
k4a_device_close.restype = None
k4a_device_close.argtypes = (_DeviceHandle,)
-
-#K4A_EXPORT k4a_wait_status_t k4a_device_get_capture(k4a_device_t device_handle,
+# K4A_EXPORT k4a_wait_status_t k4a_device_get_capture(k4a_device_t device_handle,
# k4a_capture_t *capture_handle,
# int32_t timeout_in_ms);
k4a_device_get_capture = _k4a_lib.k4a_device_get_capture
k4a_device_get_capture.restype = EWaitStatus
k4a_device_get_capture.argtypes = (_DeviceHandle, _ctypes.POINTER(_CaptureHandle), _ctypes.c_int32)
-
-#K4A_EXPORT k4a_wait_status_t k4a_device_get_imu_sample(k4a_device_t device_handle,
+# K4A_EXPORT k4a_wait_status_t k4a_device_get_imu_sample(k4a_device_t device_handle,
# k4a_imu_sample_t *imu_sample,
# int32_t timeout_in_ms);
k4a_device_get_imu_sample = _k4a_lib.k4a_device_get_imu_sample
k4a_device_get_imu_sample.restype = EWaitStatus
k4a_device_get_imu_sample.argtypes = (_DeviceHandle, _ctypes.POINTER(ImuSample), _ctypes.c_int32)
-
-#K4A_EXPORT k4a_status_t k4a_capture_create(k4a_capture_t *capture_handle);
+# K4A_EXPORT k4a_status_t k4a_capture_create(k4a_capture_t *capture_handle);
k4a_capture_create = _k4a_lib.k4a_capture_create
k4a_capture_create.restype = EStatus
k4a_capture_create.argtypes = (_ctypes.POINTER(_CaptureHandle),)
-
-#K4A_EXPORT void k4a_capture_release(k4a_capture_t capture_handle);
+# K4A_EXPORT void k4a_capture_release(k4a_capture_t capture_handle);
k4a_capture_release = _k4a_lib.k4a_capture_release
k4a_capture_release.restype = None
k4a_capture_release.argtypes = (_CaptureHandle,)
-
-#K4A_EXPORT void k4a_capture_reference(k4a_capture_t capture_handle);
+# K4A_EXPORT void k4a_capture_reference(k4a_capture_t capture_handle);
k4a_capture_reference = _k4a_lib.k4a_capture_reference
k4a_capture_reference.restype = None
k4a_capture_reference.argtypes = (_CaptureHandle,)
-
-#K4A_EXPORT k4a_image_t k4a_capture_get_color_image(k4a_capture_t capture_handle);
+# K4A_EXPORT k4a_image_t k4a_capture_get_color_image(k4a_capture_t capture_handle);
k4a_capture_get_color_image = _k4a_lib.k4a_capture_get_color_image
k4a_capture_get_color_image.restype = _ImageHandle
-k4a_capture_get_color_image.argtypes=(_CaptureHandle,)
-
+k4a_capture_get_color_image.argtypes = (_CaptureHandle,)
-#K4A_EXPORT k4a_image_t k4a_capture_get_depth_image(k4a_capture_t capture_handle);
+# K4A_EXPORT k4a_image_t k4a_capture_get_depth_image(k4a_capture_t capture_handle);
k4a_capture_get_depth_image = _k4a_lib.k4a_capture_get_depth_image
k4a_capture_get_depth_image.restype = _ImageHandle
-k4a_capture_get_depth_image.argtypes=(_CaptureHandle,)
+k4a_capture_get_depth_image.argtypes = (_CaptureHandle,)
-
-#K4A_EXPORT k4a_image_t k4a_capture_get_ir_image(k4a_capture_t capture_handle);
+# K4A_EXPORT k4a_image_t k4a_capture_get_ir_image(k4a_capture_t capture_handle);
k4a_capture_get_ir_image = _k4a_lib.k4a_capture_get_ir_image
k4a_capture_get_ir_image.restype = _ImageHandle
-k4a_capture_get_ir_image.argtypes=(_CaptureHandle,)
-
+k4a_capture_get_ir_image.argtypes = (_CaptureHandle,)
-#K4A_EXPORT void k4a_capture_set_color_image(k4a_capture_t capture_handle, k4a_image_t image_handle);
+# K4A_EXPORT void k4a_capture_set_color_image(k4a_capture_t capture_handle, k4a_image_t image_handle);
k4a_capture_set_color_image = _k4a_lib.k4a_capture_set_color_image
k4a_capture_set_color_image.restype = None
-k4a_capture_set_color_image.argtypes=(_CaptureHandle, _ImageHandle)
+k4a_capture_set_color_image.argtypes = (_CaptureHandle, _ImageHandle)
-
-#K4A_EXPORT void k4a_capture_set_depth_image(k4a_capture_t capture_handle, k4a_image_t image_handle);
+# K4A_EXPORT void k4a_capture_set_depth_image(k4a_capture_t capture_handle, k4a_image_t image_handle);
k4a_capture_set_depth_image = _k4a_lib.k4a_capture_set_depth_image
k4a_capture_set_depth_image.restype = None
-k4a_capture_set_depth_image.argtypes=(_CaptureHandle, _ImageHandle)
-
+k4a_capture_set_depth_image.argtypes = (_CaptureHandle, _ImageHandle)
-#K4A_EXPORT void k4a_capture_set_ir_image(k4a_capture_t capture_handle, k4a_image_t image_handle);
+# K4A_EXPORT void k4a_capture_set_ir_image(k4a_capture_t capture_handle, k4a_image_t image_handle);
k4a_capture_set_ir_image = _k4a_lib.k4a_capture_set_ir_image
k4a_capture_set_ir_image.restype = None
-k4a_capture_set_ir_image.argtypes=(_CaptureHandle, _ImageHandle)
-
+k4a_capture_set_ir_image.argtypes = (_CaptureHandle, _ImageHandle)
-#K4A_EXPORT void k4a_capture_set_temperature_c(k4a_capture_t capture_handle, float temperature_c);
+# K4A_EXPORT void k4a_capture_set_temperature_c(k4a_capture_t capture_handle, float temperature_c);
k4a_capture_set_temperature_c = _k4a_lib.k4a_capture_set_temperature_c
k4a_capture_set_temperature_c.restype = None
-k4a_capture_set_temperature_c.argtypes=(_CaptureHandle, _ctypes.c_float)
+k4a_capture_set_temperature_c.argtypes = (_CaptureHandle, _ctypes.c_float)
-
-#K4A_EXPORT float k4a_capture_get_temperature_c(k4a_capture_t capture_handle);
+# K4A_EXPORT float k4a_capture_get_temperature_c(k4a_capture_t capture_handle);
k4a_capture_get_temperature_c = _k4a_lib.k4a_capture_get_temperature_c
k4a_capture_get_temperature_c.restype = _ctypes.c_float
-k4a_capture_get_temperature_c.argtypes=(_CaptureHandle,)
-
+k4a_capture_get_temperature_c.argtypes = (_CaptureHandle,)
-#K4A_EXPORT k4a_status_t k4a_image_create(k4a_image_format_t format,
+# K4A_EXPORT k4a_status_t k4a_image_create(k4a_image_format_t format,
# int width_pixels,
# int height_pixels,
# int stride_bytes,
# k4a_image_t *image_handle);
k4a_image_create = _k4a_lib.k4a_image_create
k4a_image_create.restype = EStatus
-k4a_image_create.argtypes=(_ctypes.c_int, _ctypes.c_int, _ctypes.c_int, _ctypes.c_int, _ctypes.POINTER(_ImageHandle))
+k4a_image_create.argtypes = (_ctypes.c_int, _ctypes.c_int, _ctypes.c_int, _ctypes.c_int, _ctypes.POINTER(_ImageHandle))
-
-
-#K4A_EXPORT k4a_status_t k4a_image_create_from_buffer(k4a_image_format_t format,
+# K4A_EXPORT k4a_status_t k4a_image_create_from_buffer(k4a_image_format_t format,
# int width_pixels,
# int height_pixels,
# int stride_bytes,
@@ -180,160 +179,134 @@
# k4a_image_t *image_handle);
k4a_image_create_from_buffer = _k4a_lib.k4a_image_create_from_buffer
k4a_image_create_from_buffer.restype = EStatus
-k4a_image_create_from_buffer.argtypes=(
+k4a_image_create_from_buffer.argtypes = (
_ctypes.c_int, _ctypes.c_int, _ctypes.c_int, _ctypes.c_int, _ctypes.POINTER(_ctypes.c_uint8),
_ctypes.c_size_t, _memory_allocate_cb, _ctypes.c_void_p, _ctypes.POINTER(_ImageHandle))
-
-
-#K4A_EXPORT uint8_t *k4a_image_get_buffer(k4a_image_t image_handle);
+# K4A_EXPORT uint8_t *k4a_image_get_buffer(k4a_image_t image_handle);
k4a_image_get_buffer = _k4a_lib.k4a_image_get_buffer
k4a_image_get_buffer.restype = _ctypes.POINTER(_ctypes.c_uint8)
-k4a_image_get_buffer.argtypes=(_ImageHandle,)
+k4a_image_get_buffer.argtypes = (_ImageHandle,)
-
-#K4A_EXPORT size_t k4a_image_get_size(k4a_image_t image_handle);
+# K4A_EXPORT size_t k4a_image_get_size(k4a_image_t image_handle);
k4a_image_get_size = _k4a_lib.k4a_image_get_size
k4a_image_get_size.restype = _ctypes.c_size_t
-k4a_image_get_size.argtypes=(_ImageHandle,)
-
+k4a_image_get_size.argtypes = (_ImageHandle,)
-#K4A_EXPORT k4a_image_format_t k4a_image_get_format(k4a_image_t image_handle);
+# K4A_EXPORT k4a_image_format_t k4a_image_get_format(k4a_image_t image_handle);
k4a_image_get_format = _k4a_lib.k4a_image_get_format
k4a_image_get_format.restype = EImageFormat
-k4a_image_get_format.argtypes=(_ImageHandle,)
+k4a_image_get_format.argtypes = (_ImageHandle,)
-
-#K4A_EXPORT int k4a_image_get_width_pixels(k4a_image_t image_handle);
+# K4A_EXPORT int k4a_image_get_width_pixels(k4a_image_t image_handle);
k4a_image_get_width_pixels = _k4a_lib.k4a_image_get_width_pixels
k4a_image_get_width_pixels.restype = _ctypes.c_int
-k4a_image_get_width_pixels.argtypes=(_ImageHandle,)
-
+k4a_image_get_width_pixels.argtypes = (_ImageHandle,)
-#K4A_EXPORT int k4a_image_get_height_pixels(k4a_image_t image_handle);
+# K4A_EXPORT int k4a_image_get_height_pixels(k4a_image_t image_handle);
k4a_image_get_height_pixels = _k4a_lib.k4a_image_get_height_pixels
k4a_image_get_height_pixels.restype = _ctypes.c_int
-k4a_image_get_height_pixels.argtypes=(_ImageHandle,)
+k4a_image_get_height_pixels.argtypes = (_ImageHandle,)
-
-#K4A_EXPORT int k4a_image_get_stride_bytes(k4a_image_t image_handle);
+# K4A_EXPORT int k4a_image_get_stride_bytes(k4a_image_t image_handle);
k4a_image_get_stride_bytes = _k4a_lib.k4a_image_get_stride_bytes
k4a_image_get_stride_bytes.restype = _ctypes.c_int
-k4a_image_get_stride_bytes.argtypes=(_ImageHandle,)
-
+k4a_image_get_stride_bytes.argtypes = (_ImageHandle,)
-#K4A_EXPORT uint64_t k4a_image_get_device_timestamp_usec(k4a_image_t image_handle);
+# K4A_EXPORT uint64_t k4a_image_get_device_timestamp_usec(k4a_image_t image_handle);
k4a_image_get_device_timestamp_usec = _k4a_lib.k4a_image_get_device_timestamp_usec
k4a_image_get_device_timestamp_usec.restype = _ctypes.c_uint64
-k4a_image_get_device_timestamp_usec.argtypes=(_ImageHandle,)
+k4a_image_get_device_timestamp_usec.argtypes = (_ImageHandle,)
-
-#K4A_EXPORT uint64_t k4a_image_get_system_timestamp_nsec(k4a_image_t image_handle);
+# K4A_EXPORT uint64_t k4a_image_get_system_timestamp_nsec(k4a_image_t image_handle);
k4a_image_get_system_timestamp_nsec = _k4a_lib.k4a_image_get_system_timestamp_nsec
k4a_image_get_system_timestamp_nsec.restype = _ctypes.c_uint64
-k4a_image_get_system_timestamp_nsec.argtypes=(_ImageHandle,)
-
+k4a_image_get_system_timestamp_nsec.argtypes = (_ImageHandle,)
-#K4A_EXPORT uint64_t k4a_image_get_exposure_usec(k4a_image_t image_handle);
+# K4A_EXPORT uint64_t k4a_image_get_exposure_usec(k4a_image_t image_handle);
k4a_image_get_exposure_usec = _k4a_lib.k4a_image_get_exposure_usec
k4a_image_get_exposure_usec.restype = _ctypes.c_uint64
-k4a_image_get_exposure_usec.argtypes=(_ImageHandle,)
+k4a_image_get_exposure_usec.argtypes = (_ImageHandle,)
-
-#K4A_EXPORT uint32_t k4a_image_get_white_balance(k4a_image_t image_handle);
+# K4A_EXPORT uint32_t k4a_image_get_white_balance(k4a_image_t image_handle);
k4a_image_get_white_balance = _k4a_lib.k4a_image_get_white_balance
k4a_image_get_white_balance.restype = _ctypes.c_uint32
-k4a_image_get_white_balance.argtypes=(_ImageHandle,)
-
+k4a_image_get_white_balance.argtypes = (_ImageHandle,)
-#K4A_EXPORT uint32_t k4a_image_get_iso_speed(k4a_image_t image_handle);
+# K4A_EXPORT uint32_t k4a_image_get_iso_speed(k4a_image_t image_handle);
k4a_image_get_iso_speed = _k4a_lib.k4a_image_get_iso_speed
k4a_image_get_iso_speed.restype = _ctypes.c_uint32
-k4a_image_get_iso_speed.argtypes=(_ImageHandle,)
-
+k4a_image_get_iso_speed.argtypes = (_ImageHandle,)
-#K4A_EXPORT void k4a_image_set_device_timestamp_usec(k4a_image_t image_handle, uint64_t timestamp_usec);
+# K4A_EXPORT void k4a_image_set_device_timestamp_usec(k4a_image_t image_handle, uint64_t timestamp_usec);
k4a_image_set_device_timestamp_usec = _k4a_lib.k4a_image_set_device_timestamp_usec
k4a_image_set_device_timestamp_usec.restype = None
-k4a_image_set_device_timestamp_usec.argtypes=(_ImageHandle, _ctypes.c_uint64)
+k4a_image_set_device_timestamp_usec.argtypes = (_ImageHandle, _ctypes.c_uint64)
-
-#K4A_EXPORT void k4a_image_set_system_timestamp_nsec(k4a_image_t image_handle, uint64_t timestamp_nsec);
+# K4A_EXPORT void k4a_image_set_system_timestamp_nsec(k4a_image_t image_handle, uint64_t timestamp_nsec);
k4a_image_set_system_timestamp_nsec = _k4a_lib.k4a_image_set_system_timestamp_nsec
k4a_image_set_system_timestamp_nsec.restype = None
-k4a_image_set_system_timestamp_nsec.argtypes=(_ImageHandle, _ctypes.c_uint64)
-
+k4a_image_set_system_timestamp_nsec.argtypes = (_ImageHandle, _ctypes.c_uint64)
-#K4A_EXPORT void k4a_image_set_exposure_usec(k4a_image_t image_handle, uint64_t exposure_usec);
+# K4A_EXPORT void k4a_image_set_exposure_usec(k4a_image_t image_handle, uint64_t exposure_usec);
k4a_image_set_exposure_usec = _k4a_lib.k4a_image_set_exposure_usec
k4a_image_set_exposure_usec.restype = None
-k4a_image_set_exposure_usec.argtypes=(_ImageHandle, _ctypes.c_uint64)
+k4a_image_set_exposure_usec.argtypes = (_ImageHandle, _ctypes.c_uint64)
-
-#K4A_EXPORT void k4a_image_set_white_balance(k4a_image_t image_handle, uint32_t white_balance);
+# K4A_EXPORT void k4a_image_set_white_balance(k4a_image_t image_handle, uint32_t white_balance);
k4a_image_set_white_balance = _k4a_lib.k4a_image_set_white_balance
k4a_image_set_white_balance.restype = None
-k4a_image_set_white_balance.argtypes=(_ImageHandle, _ctypes.c_uint32)
-
+k4a_image_set_white_balance.argtypes = (_ImageHandle, _ctypes.c_uint32)
-#K4A_EXPORT void k4a_image_set_iso_speed(k4a_image_t image_handle, uint32_t iso_speed);
+# K4A_EXPORT void k4a_image_set_iso_speed(k4a_image_t image_handle, uint32_t iso_speed);
k4a_image_set_iso_speed = _k4a_lib.k4a_image_set_iso_speed
k4a_image_set_iso_speed.restype = None
-k4a_image_set_iso_speed.argtypes=(_ImageHandle, _ctypes.c_uint32)
+k4a_image_set_iso_speed.argtypes = (_ImageHandle, _ctypes.c_uint32)
-
-#K4A_EXPORT void k4a_image_reference(k4a_image_t image_handle);
+# K4A_EXPORT void k4a_image_reference(k4a_image_t image_handle);
k4a_image_reference = _k4a_lib.k4a_image_reference
k4a_image_reference.restype = None
-k4a_image_reference.argtypes=(_ImageHandle,)
-
+k4a_image_reference.argtypes = (_ImageHandle,)
-#K4A_EXPORT void k4a_image_release(k4a_image_t image_handle);
+# K4A_EXPORT void k4a_image_release(k4a_image_t image_handle);
k4a_image_release = _k4a_lib.k4a_image_release
k4a_image_release.restype = None
-k4a_image_release.argtypes=(_ImageHandle,)
+k4a_image_release.argtypes = (_ImageHandle,)
-
-#K4A_EXPORT k4a_status_t k4a_device_start_cameras(k4a_device_t device_handle, const k4a_device_configuration_t *config);
+# K4A_EXPORT k4a_status_t k4a_device_start_cameras(k4a_device_t device_handle, const k4a_device_configuration_t *config);
k4a_device_start_cameras = _k4a_lib.k4a_device_start_cameras
k4a_device_start_cameras.restype = EWaitStatus
k4a_device_start_cameras.argtypes = (_DeviceHandle, _ctypes.POINTER(DeviceConfiguration))
-
-#K4A_EXPORT void k4a_device_stop_cameras(k4a_device_t device_handle);
+# K4A_EXPORT void k4a_device_stop_cameras(k4a_device_t device_handle);
k4a_device_stop_cameras = _k4a_lib.k4a_device_stop_cameras
k4a_device_stop_cameras.restype = None
-k4a_device_stop_cameras.argtypes=(_DeviceHandle,)
+k4a_device_stop_cameras.argtypes = (_DeviceHandle,)
-
-#K4A_EXPORT k4a_status_t k4a_device_start_imu(k4a_device_t device_handle);
+# K4A_EXPORT k4a_status_t k4a_device_start_imu(k4a_device_t device_handle);
k4a_device_start_imu = _k4a_lib.k4a_device_start_imu
k4a_device_start_imu.restype = EStatus
k4a_device_start_imu.argtypes = (_DeviceHandle,)
-
-#K4A_EXPORT void k4a_device_stop_imu(k4a_device_t device_handle);
+# K4A_EXPORT void k4a_device_stop_imu(k4a_device_t device_handle);
k4a_device_stop_imu = _k4a_lib.k4a_device_stop_imu
k4a_device_stop_imu.restype = None
k4a_device_stop_imu.argtypes = (_DeviceHandle,)
-
-#K4A_EXPORT k4a_buffer_result_t k4a_device_get_serialnum(k4a_device_t device_handle,
+# K4A_EXPORT k4a_buffer_result_t k4a_device_get_serialnum(k4a_device_t device_handle,
# char *serial_number,
# size_t *serial_number_size);
k4a_device_get_serialnum = _k4a_lib.k4a_device_get_serialnum
k4a_device_get_serialnum.restype = EBufferStatus
-k4a_device_get_serialnum.argtypes = (_DeviceHandle,
- _ctypes.POINTER(_ctypes.c_char), _ctypes.POINTER(_ctypes.c_size_t))
-
+k4a_device_get_serialnum.argtypes = (_DeviceHandle,
+ _ctypes.POINTER(_ctypes.c_char), _ctypes.POINTER(_ctypes.c_size_t))
-#K4A_EXPORT k4a_status_t k4a_device_get_version(k4a_device_t device_handle, HardwareVersion *version);
+# K4A_EXPORT k4a_status_t k4a_device_get_version(k4a_device_t device_handle, HardwareVersion *version);
k4a_device_get_version = _k4a_lib.k4a_device_get_version
k4a_device_get_version.restype = EStatus
k4a_device_get_version.argtypes = (_DeviceHandle, _ctypes.POINTER(HardwareVersion))
-
-#K4A_EXPORT k4a_status_t k4a_device_get_color_control_capabilities(k4a_device_t device_handle,
+# K4A_EXPORT k4a_status_t k4a_device_get_color_control_capabilities(k4a_device_t device_handle,
# k4a_color_control_command_t command,
# bool *supports_auto,
# int32_t *min_value,
@@ -347,19 +320,18 @@
_DeviceHandle, _ctypes.c_int, _ctypes.POINTER(_ctypes.c_bool),
_ctypes.POINTER(_ctypes.c_int32), _ctypes.POINTER(_ctypes.c_int32),
_ctypes.POINTER(_ctypes.c_int32), _ctypes.POINTER(_ctypes.c_int32),
- _ctypes.POINTER(_ctypes.c_int) )
-
+ _ctypes.POINTER(_ctypes.c_int))
-#K4A_EXPORT k4a_status_t k4a_device_get_color_control(k4a_device_t device_handle,
+# K4A_EXPORT k4a_status_t k4a_device_get_color_control(k4a_device_t device_handle,
# k4a_color_control_command_t command,
# k4a_color_control_mode_t *mode,
# int32_t *value);
k4a_device_get_color_control = _k4a_lib.k4a_device_get_color_control
k4a_device_get_color_control.restype = EStatus
-k4a_device_get_color_control.argtypes = (_DeviceHandle, _ctypes.c_int, _ctypes.POINTER(_ctypes.c_int), _ctypes.POINTER(_ctypes.c_int32))
+k4a_device_get_color_control.argtypes = (
+ _DeviceHandle, _ctypes.c_int, _ctypes.POINTER(_ctypes.c_int), _ctypes.POINTER(_ctypes.c_int32))
-
-#K4A_EXPORT k4a_status_t k4a_device_set_color_control(k4a_device_t device_handle,
+# K4A_EXPORT k4a_status_t k4a_device_set_color_control(k4a_device_t device_handle,
# k4a_color_control_command_t command,
# k4a_color_control_mode_t mode,
# int32_t value);
@@ -367,16 +339,15 @@
k4a_device_set_color_control.restype = EStatus
k4a_device_set_color_control.argtypes = (_DeviceHandle, _ctypes.c_int, _ctypes.c_int, _ctypes.c_int32)
-
-#K4A_EXPORT k4a_buffer_result_t k4a_device_get_raw_calibration(k4a_device_t device_handle,
+# K4A_EXPORT k4a_buffer_result_t k4a_device_get_raw_calibration(k4a_device_t device_handle,
# uint8_t *data,
# size_t *data_size);
k4a_device_get_raw_calibration = _k4a_lib.k4a_device_get_raw_calibration
k4a_device_get_raw_calibration.restype = EBufferStatus
-k4a_device_get_raw_calibration.argtypes = (_DeviceHandle, _ctypes.POINTER(_ctypes.c_uint8), _ctypes.POINTER(_ctypes.c_size_t))
+k4a_device_get_raw_calibration.argtypes = (
+ _DeviceHandle, _ctypes.POINTER(_ctypes.c_uint8), _ctypes.POINTER(_ctypes.c_size_t))
-
-#K4A_EXPORT k4a_status_t k4a_device_get_calibration(k4a_device_t device_handle,
+# K4A_EXPORT k4a_status_t k4a_device_get_calibration(k4a_device_t device_handle,
# const k4a_depth_mode_t depth_mode,
# const k4a_color_resolution_t color_resolution,
# k4a_calibration_t *calibration);
@@ -384,27 +355,24 @@
k4a_device_get_calibration.restype = EStatus
k4a_device_get_calibration.argtypes = (_DeviceHandle, _ctypes.c_int, _ctypes.c_int, _ctypes.POINTER(_Calibration))
-
-#K4A_EXPORT k4a_status_t k4a_device_get_sync_jack(k4a_device_t device_handle,
+# K4A_EXPORT k4a_status_t k4a_device_get_sync_jack(k4a_device_t device_handle,
# bool *sync_in_jack_connected,
# bool *sync_out_jack_connected);
k4a_device_get_sync_jack = _k4a_lib.k4a_device_get_sync_jack
k4a_device_get_sync_jack.restype = EStatus
k4a_device_get_sync_jack.argtypes = (_DeviceHandle, _ctypes.POINTER(_ctypes.c_bool), _ctypes.POINTER(_ctypes.c_bool))
-
-#K4A_EXPORT k4a_status_t k4a_calibration_get_from_raw(char *raw_calibration,
+# K4A_EXPORT k4a_status_t k4a_calibration_get_from_raw(char *raw_calibration,
# size_t raw_calibration_size,
# const k4a_depth_mode_t depth_mode,
# const k4a_color_resolution_t color_resolution,
# k4a_calibration_t *calibration);
k4a_calibration_get_from_raw = _k4a_lib.k4a_calibration_get_from_raw
k4a_calibration_get_from_raw.restype = EStatus
-k4a_calibration_get_from_raw.argtypes = (_ctypes.POINTER(_ctypes.c_char),
- _ctypes.c_size_t, _ctypes.c_int, _ctypes.c_int, _ctypes.POINTER(_Calibration))
-
+k4a_calibration_get_from_raw.argtypes = (_ctypes.POINTER(_ctypes.c_char),
+ _ctypes.c_size_t, _ctypes.c_int, _ctypes.c_int, _ctypes.POINTER(_Calibration))
-#K4A_EXPORT k4a_status_t k4a_calibration_3d_to_3d(const k4a_calibration_t *calibration,
+# K4A_EXPORT k4a_status_t k4a_calibration_3d_to_3d(const k4a_calibration_t *calibration,
# const k4a_float3_t *source_point3d_mm,
# const k4a_calibration_type_t source_camera,
# const k4a_calibration_type_t target_camera,
@@ -415,8 +383,7 @@
_ctypes.POINTER(_Calibration), _ctypes.POINTER(_Float3),
_ctypes.c_int, _ctypes.c_int, _ctypes.POINTER(_Float3))
-
-#K4A_EXPORT k4a_status_t k4a_calibration_2d_to_3d(const k4a_calibration_t *calibration,
+# K4A_EXPORT k4a_status_t k4a_calibration_2d_to_3d(const k4a_calibration_t *calibration,
# const k4a_float2_t *source_point2d,
# const float source_depth_mm,
# const k4a_calibration_type_t source_camera,
@@ -429,8 +396,7 @@
_ctypes.POINTER(_Calibration), _ctypes.POINTER(_Float2), _ctypes.c_float,
_ctypes.c_int, _ctypes.c_int, _ctypes.POINTER(_Float3), _ctypes.POINTER(_ctypes.c_int))
-
-#K4A_EXPORT k4a_status_t k4a_calibration_3d_to_2d(const k4a_calibration_t *calibration,
+# K4A_EXPORT k4a_status_t k4a_calibration_3d_to_2d(const k4a_calibration_t *calibration,
# const k4a_float3_t *source_point3d_mm,
# const k4a_calibration_type_t source_camera,
# const k4a_calibration_type_t target_camera,
@@ -442,8 +408,7 @@
_ctypes.POINTER(_Calibration), _ctypes.POINTER(_Float3),
_ctypes.c_int, _ctypes.c_int, _ctypes.POINTER(_Float2), _ctypes.POINTER(_ctypes.c_int))
-
-#K4A_EXPORT k4a_status_t k4a_calibration_2d_to_2d(const k4a_calibration_t *calibration,
+# K4A_EXPORT k4a_status_t k4a_calibration_2d_to_2d(const k4a_calibration_t *calibration,
# const k4a_float2_t *source_point2d,
# const float source_depth_mm,
# const k4a_calibration_type_t source_camera,
@@ -456,8 +421,7 @@
_ctypes.POINTER(_Calibration), _ctypes.POINTER(_Float2), _ctypes.c_float,
_ctypes.c_int, _ctypes.c_int, _ctypes.POINTER(_Float2), _ctypes.POINTER(_ctypes.c_int))
-
-#K4A_EXPORT k4a_status_t k4a_calibration_color_2d_to_depth_2d(const k4a_calibration_t *calibration,
+# K4A_EXPORT k4a_status_t k4a_calibration_color_2d_to_depth_2d(const k4a_calibration_t *calibration,
# const k4a_float2_t *source_point2d,
# const k4a_image_t depth_image,
# k4a_float2_t *target_point2d,
@@ -468,20 +432,17 @@
_ctypes.POINTER(_Calibration), _ctypes.POINTER(_Float2), _ImageHandle,
_ctypes.POINTER(_Float2), _ctypes.POINTER(_ctypes.c_int))
-
-#K4A_EXPORT k4a_transform_t k4a_transformation_create(const k4a_calibration_t *calibration);
+# K4A_EXPORT k4a_transform_t k4a_transformation_create(const k4a_calibration_t *calibration);
k4a_transformation_create = _k4a_lib.k4a_transformation_create
k4a_transformation_create.restype = _TransformationHandle
k4a_transformation_create.argtypes = (_ctypes.POINTER(_Calibration),)
-
-#K4A_EXPORT void k4a_transformation_destroy(k4a_transform_t transformation_handle);
+# K4A_EXPORT void k4a_transformation_destroy(k4a_transform_t transformation_handle);
k4a_transformation_destroy = _k4a_lib.k4a_transformation_destroy
k4a_transformation_destroy.restype = None
k4a_transformation_destroy.argtypes = (_TransformationHandle,)
-
-#K4A_EXPORT k4a_status_t k4a_transformation_depth_image_to_color_camera(k4a_transform_t transformation_handle,
+# K4A_EXPORT k4a_status_t k4a_transformation_depth_image_to_color_camera(k4a_transform_t transformation_handle,
# const k4a_image_t depth_image,
# k4a_image_t transformed_depth_image);
k4a_transformation_depth_image_to_color_camera = _k4a_lib.k4a_transformation_depth_image_to_color_camera
@@ -489,9 +450,8 @@
k4a_transformation_depth_image_to_color_camera.argtypes = (
_TransformationHandle, _ImageHandle, _ImageHandle)
-
-#K4A_EXPORT k4a_status_t
-#k4a_transformation_depth_image_to_color_camera_custom(k4a_transform_t transformation_handle,
+# K4A_EXPORT k4a_status_t
+# k4a_transformation_depth_image_to_color_camera_custom(k4a_transform_t transformation_handle,
# const k4a_image_t depth_image,
# const k4a_image_t custom_image,
# k4a_image_t transformed_depth_image,
@@ -504,20 +464,20 @@
_TransformationHandle, _ImageHandle, _ImageHandle, _ImageHandle, _ImageHandle,
_ctypes.c_int, _ctypes.c_uint32)
-
-#K4A_EXPORT k4a_status_t k4a_transformation_color_image_to_depth_camera(k4a_transform_t transformation_handle,
+# K4A_EXPORT k4a_status_t k4a_transformation_color_image_to_depth_camera(k4a_transform_t transformation_handle,
# const k4a_image_t depth_image,
# const k4a_image_t color_image,
# k4a_image_t transformed_color_image);
k4a_transformation_color_image_to_depth_camera = _k4a_lib.k4a_transformation_color_image_to_depth_camera
k4a_transformation_color_image_to_depth_camera.restype = EStatus
-k4a_transformation_color_image_to_depth_camera.argtypes = (_TransformationHandle, _ImageHandle, _ImageHandle, _ImageHandle)
-
+k4a_transformation_color_image_to_depth_camera.argtypes = (
+ _TransformationHandle, _ImageHandle, _ImageHandle, _ImageHandle)
-#K4A_EXPORT k4a_status_t k4a_transformation_depth_image_to_point_cloud(k4a_transform_t transformation_handle,
+# K4A_EXPORT k4a_status_t k4a_transformation_depth_image_to_point_cloud(k4a_transform_t transformation_handle,
# const k4a_image_t depth_image,
# const k4a_calibration_type_t camera,
# k4a_image_t xyz_image);
k4a_transformation_depth_image_to_point_cloud = _k4a_lib.k4a_transformation_depth_image_to_point_cloud
k4a_transformation_depth_image_to_point_cloud.restype = EStatus
-k4a_transformation_depth_image_to_point_cloud.argtypes = (_TransformationHandle, _ImageHandle, _ctypes.c_int, _ImageHandle)
+k4a_transformation_depth_image_to_point_cloud.argtypes = (
+ _TransformationHandle, _ImageHandle, _ctypes.c_int, _ImageHandle)
diff --git a/src/python/k4a/src/k4a/_bindings/k4atypes.py b/src/python/k4a/src/k4a/_bindings/k4atypes.py
index a75abde54..e4a412e2c 100644
--- a/src/python/k4a/src/k4a/_bindings/k4atypes.py
+++ b/src/python/k4a/src/k4a/_bindings/k4atypes.py
@@ -1,4 +1,4 @@
-'''!
+"""!
@file k4atypes.py
Defines common enums and structures used in the Azure Kinect SDK.
@@ -7,8 +7,7 @@
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Kinect For Azure SDK.
-'''
-
+"""
from enum import IntEnum as _IntEnum
from enum import unique as _unique
@@ -17,7 +16,6 @@
from os import linesep as _newline
import platform as _platform
-
# Determine the calling convention to use.
_IS_WINDOWS = 'Windows' == _platform.system()
if _IS_WINDOWS:
@@ -28,27 +26,27 @@
@_unique
class EStatus(_IntEnum):
- '''! Result code returned by Azure Kinect APIs.
+ """! Result code returned by Azure Kinect APIs.
Name | Description
----------------- | -------------------------------------------------------
EStatus.SUCCEEDED | Successful status.
EStatus.FAILED | Failed status.
- '''
+ """
SUCCEEDED = 0
FAILED = _auto()
@_unique
class EBufferStatus(_IntEnum):
- '''! Result code returned by Azure Kinect APIs.
+ """! Result code returned by Azure Kinect APIs.
Name | Description
------------------------------- | -----------------------------------------
EBufferStatus.SUCCEEDED | Successful buffer request status.
EBufferStatus.FAILED | Failed buffer request status.
EBufferStatus.BUFFER_TOO_SMALL | Buffer is too small.
- '''
+ """
SUCCEEDED = 0
FAILED = _auto()
BUFFER_TOO_SMALL = _auto()
@@ -56,14 +54,14 @@ class EBufferStatus(_IntEnum):
@_unique
class EWaitStatus(_IntEnum):
- '''! Result code returned by Azure Kinect APIs.
+ """! Result code returned by Azure Kinect APIs.
Name | Description
------------------------------- | -----------------------------------------
EWaitStatus.SUCCEEDED | Successful result status.
EWaitStatus.FAILED | Failed result status.
EWaitStatus.TIMEOUT | The request timed out.
- '''
+ """
SUCCEEDED = 0
FAILED = _auto()
TIMEOUT = _auto()
@@ -71,7 +69,7 @@ class EWaitStatus(_IntEnum):
@_unique
class ELogLevel(_IntEnum):
- '''! Verbosity levels of debug messaging.
+ """! Verbosity levels of debug messaging.
Name | Description
------------------------------- | -----------------------------------------
@@ -81,7 +79,7 @@ class ELogLevel(_IntEnum):
ELogLevel.INFO | 2nd least severe level of debug messaging.
ELogLevel.TRACE | Least severe level of debug messaging.
ELogLevel.OFF | No logging is performed.
- '''
+ """
CRITICAL = 0
ERROR = _auto()
WARNING = _auto()
@@ -92,7 +90,7 @@ class ELogLevel(_IntEnum):
@_unique
class EDepthMode(_IntEnum):
- '''! Depth sensor capture modes.
+ """! Depth sensor capture modes.
See the hardware specification for additional details on the field of view
and supported frame rates for each mode.
@@ -110,7 +108,7 @@ class EDepthMode(_IntEnum):
EDepthMode.WFOV_2X2BINNED | Depth and Active IR captured at 512x512.
EDepthMode.WFOV_UNBINNED | Depth and Active IR captured at 1024x1024.
EDepthMode.PASSIVE_IR | Passive IR only, captured at 1024x1024.
- '''
+ """
OFF = 0
NFOV_2X2BINNED = _auto()
NFOV_UNBINNED = _auto()
@@ -121,7 +119,7 @@ class EDepthMode(_IntEnum):
@_unique
class EColorResolution(_IntEnum):
- '''! Color sensor resolutions, width * height and aspect ratio.
+ """! Color sensor resolutions, width * height and aspect ratio.
Name | Description
------------------------------- | -----------------------------------------
@@ -132,7 +130,7 @@ class EColorResolution(_IntEnum):
EColorResolution.RES_1536P | 2048 * 1536 4:3.
EColorResolution.RES_2160P | 3840 * 2160 16:9.
EColorResolution.RES_3072P | 4096 * 3072 4:3.
- '''
+ """
OFF = 0
RES_720P = _auto()
RES_1080P = _auto()
@@ -144,16 +142,16 @@ class EColorResolution(_IntEnum):
@_unique
class EImageFormat(_IntEnum):
- '''! Image format type.
-
+ """! Image format type.
+
The image format indicates how the buffer image data is interpreted.
Name | Description |
-
+
EImageFormat.COLOR_MJPG |
- Color image type MJPG.
+ | Color image type MJPG.
- The buffer for each image is encoded as a JPEG and can be
decoded by a JPEG decoder.
- Because the image is compressed, the stride parameter for the
@@ -173,7 +171,7 @@ class EImageFormat(_IntEnum):
half the width in pixels of the luminance. Each chroma line
has the same width in bytes as a luminance line.
|
-
+
EImageFormat.COLOR_YUY2 |
Color image type YUY2.
- YUY2 stores chroma and luminance data in interleaved pixels.
@@ -184,7 +182,7 @@ class EImageFormat(_IntEnum):
|
EImageFormat.COLOR_BGRA32 |
Color image type BGRA32.
- - Each pixel of BGRA32 data is four bytes. The first three
+ - Each pixel of BGRA32 data is four bytes. The first three
bytes represent Blue, Green, and Red data. The fourth byte
is the alpha channel and is unused in Azure Kinect APIs.
- Stride indicates the length of each line in bytes and should
@@ -207,8 +205,8 @@ class EImageFormat(_IntEnum):
|
EImageFormat.IR16 |
Image type IR16.
- - Each pixel of IR16 data is two bytes of little endian
- unsigned depth data. The value of the data represents
+ - Each pixel of IR16 data is two bytes of little endian
+ unsigned depth data. The value of the data represents
brightness.
- This format represents infrared light and is captured by the
depth camera.
@@ -219,7 +217,7 @@ class EImageFormat(_IntEnum):
|
EImageFormat.CUSTOM8 |
Single channel image type CUSTOM8.
- - Each pixel of CUSTOM8 is a single channel one byte of
+ - Each pixel of CUSTOM8 is a single channel one byte of
unsigned data.
- Stride indicates the length of each line in bytes and should
be used to determine the start location of each line of the
@@ -228,24 +226,23 @@ class EImageFormat(_IntEnum):
|
EImageFormat.CUSTOM16 |
Single channel image type CUSTOM16.
- - Each pixel of CUSTOM16 is a single channel two byte of
+ - Each pixel of CUSTOM16 is a single channel two byte of
unsigned data.
- Stride indicates the length of each line in bytes and should
be used to determine the start location of each line of the
image in memory.
- |
+
EImageFormat.CUSTOM |
Custom image format.
- - Used in conjunction with user created images or images
+ - Used in conjunction with user created images or images
packing non-standard data.
- - See the originator of the custom formatted image for
+ - See the originator of the custom formatted image for
information on how to interpret the data.
|
- '''
+ """
-
COLOR_MJPG = 0
COLOR_NV12 = _auto()
COLOR_YUY2 = _auto()
@@ -259,7 +256,7 @@ class EImageFormat(_IntEnum):
@_unique
class ETransformInterpolationType(_IntEnum):
- '''! Transformation interpolation type.
+ """! Transformation interpolation type.
Interpolation type used with transformation from depth image to color
camera custom.
@@ -268,17 +265,17 @@ class ETransformInterpolationType(_IntEnum):
----------------------------------- | -------------------------------------
ETransformInterpolationType.NEAREST | Nearest neighbor interpolation.
ETransformInterpolationType.LINEAR | Linear interpolation.
- '''
+ """
NEAREST = 0
LINEAR = _auto()
@_unique
class EFramesPerSecond(_IntEnum):
- '''! Color and depth sensor frame rate.
+ """! Color and depth sensor frame rate.
This enumeration is used to select the desired frame rate to operate the
- cameras. The actual frame rate may vary slightly due to dropped data,
+ cameras. The actual frame rate may vary slightly due to dropped data,
synchronization variation between devices, clock accuracy, or if the camera
exposure priority mode causes reduced frame rate.
@@ -287,7 +284,7 @@ class EFramesPerSecond(_IntEnum):
EFramesPerSecond.FPS_5 | 5 frames per second.
EFramesPerSecond.FPS_15 | 15 frames per second.
EFramesPerSecond.FPS_30 | 30 frames per second.
- '''
+ """
FPS_5 = 0
FPS_15 = _auto()
FPS_30 = _auto()
@@ -295,36 +292,36 @@ class EFramesPerSecond(_IntEnum):
@_unique
class EColorControlCommand(_IntEnum):
- '''! Color sensor control commands
+ """! Color sensor control commands
The current settings can be read with k4a_device_get_color_control(). The
settings can be set with k4a_device_set_color_control().
- Control values set on a device are reset only when the device is power
- cycled. The device will retain the settings even if the _DeviceHandle is
+ Control values set on a device are reset only when the device is power
+ cycled. The device will retain the settings even if the _DeviceHandle is
closed or the application is restarted.
Name | Description |
-
+
EColorControlCommand.EXPOSURE_TIME_ABSOLUTE |
Exposure time setting.
- - May be set to EColorControlMode.AUTO or
+ - May be set to EColorControlMode.AUTO or
EColorControlMode.MANUAL.
- - The Azure Kinect supports a limited number of
+ - The Azure Kinect supports a limited number of
fixed expsore settings. When setting this, expect
- the exposure to be rounded up to the nearest
+ the exposure to be rounded up to the nearest
setting. Exceptions are:
1) The last value in the table is the upper limit,
so a value larger than this will be overridden
- to the largest entry in the table.
- 2) The exposure time cannot be larger than the
+ to the largest entry in the table.
+ 2) The exposure time cannot be larger than the
equivelent FPS. So expect 100ms exposure time
- to be reduced to 30ms or 33.33ms when the
- camera is started.
- - The most recent copy of the table
- 'device_exposure_mapping' is in
+ to be reduced to 30ms or 33.33ms when the
+ camera is started.
+ - The most recent copy of the table
+ 'device_exposure_mapping' is in
https://github.com/microsoft/Azure-Kinect-Sensor-SDK/blob/develop/src/color/color_priv.h
- Exposure time is measured in microseconds.
|
@@ -332,11 +329,11 @@ class EColorControlCommand(_IntEnum):
EColorControlCommand.AUTO_EXPOSURE_PRIORITY |
Exposure or Framerate priority setting.
- May only be set to EColorControlMode.MANUAL.
- - Value of 0 means framerate priority.
+ - Value of 0 means framerate priority.
Value of 1 means exposure priority.
- Using exposure priority may impact the framerate
of both the color and depth cameras.
- - Deprecated starting in 1.2.0. Please discontinue
+ - Deprecated starting in 1.2.0. Please discontinue
usage, firmware does not support this.
|
@@ -363,7 +360,7 @@ class EColorControlCommand(_IntEnum):
EColorControlCommand.WHITEBALANCE |
White balance setting.
- - May be set to EColorControlMode.AUTO or
+ - May be set to EColorControlMode.AUTO or
EColorControlMode.MANUAL.
- The unit is degrees Kelvin. The setting must be
set to a value evenly divisible by 10 degrees.
@@ -372,23 +369,23 @@ class EColorControlCommand(_IntEnum):
|
EColorControlCommand.BACKLIGHT_COMPENSATION |
Backlight compensation setting.
- May only be set to EColorControlMode.MANUAL.
- - Value of 0 means backlight compensation is disabled.
+ - Value of 0 means backlight compensation is disabled.
Value of 1 means backlight compensation is enabled.
|
EColorControlCommand.GAIN |
Gain setting.
- - May only be set to EColorControlMode.MANUAL.
+ - May only be set to EColorControlMode.MANUAL.
|
EColorControlCommand.POWERLINE_FREQUENCY |
Powerline frequency setting.
- May only be set to EColorControlMode.MANUAL.
- - Value of 1 sets the powerline compensation to 50 Hz.
+ - Value of 1 sets the powerline compensation to 50 Hz.
Value of 2 sets the powerline compensation to 60 Hz.
|
- '''
+ """
EXPOSURE_TIME_ABSOLUTE = 0
AUTO_EXPOSURE_PRIORITY = _auto()
BRIGHTNESS = _auto()
@@ -403,7 +400,7 @@ class EColorControlCommand(_IntEnum):
@_unique
class EColorControlMode(_IntEnum):
- '''! Color sensor control mode.
+ """! Color sensor control mode.
The current settings can be read with k4a_device_get_color_control(). The
settings can be set with k4a_device_set_color_control().
@@ -412,24 +409,24 @@ class EColorControlMode(_IntEnum):
------------------------------- | -----------------------------------------
EColorControlMode.AUTO | Set EColorControlCommand to auto.
EColorControlMode.MANUAL | Set EColorControlCommand to manual.
- '''
+ """
AUTO = 0
MANUAL = _auto()
@_unique
class EWiredSyncMode(_IntEnum):
- '''! Synchronization mode when connecting two or more devices together.
+ """! Synchronization mode when connecting two or more devices together.
Name | Description |
-
+
EWiredSyncMode.STANDALONE |
- Neither 'Sync In' or 'Sync Out' connections are used. |
+ Neither 'Sync In' nor 'Sync Out' connections are used. |
EWiredSyncMode.MASTER |
- The 'Sync Out' jack is enabled and synchronization data it
+ | The 'Sync Out' jack is enabled and synchronization data is
driven out the connected wire. While in master mode the color
camera must be enabled as part of the multi device sync
signalling logic. Even if the color image is not needed, the
@@ -442,7 +439,7 @@ class EWiredSyncMode(_IntEnum):
mirror of 'Sync In' for this mode.
|
- '''
+ """
STANDALONE = 0
MASTER = _auto()
SUBORDINATE = _auto()
@@ -450,7 +447,7 @@ class EWiredSyncMode(_IntEnum):
@_unique
class ECalibrationType(_IntEnum):
- '''! Calibration types.
+ """! Calibration types.
Specifies a type of calibration.
@@ -460,9 +457,9 @@ class ECalibrationType(_IntEnum):
ECalibrationType.DEPTH | Depth sensor.
ECalibrationType.COLOR | Color sensor.
ECalibrationType.GYRO | Gyroscope sensor.
- ECalibrationType.ACCEL | Acceleremeter sensor.
+ ECalibrationType.ACCEL | Accelerometer sensor.
ECalibrationType.NUM_TYPES | Number of types excluding unknown type.
- '''
+ """
UNKNOWN = -1
DEPTH = _auto()
COLOR = _auto()
@@ -473,7 +470,7 @@ class ECalibrationType(_IntEnum):
@_unique
class ECalibrationModelType(_IntEnum):
- '''! Calibration model type.
+ """! Calibration model type.
The model used interpret the calibration parameters.
@@ -484,7 +481,7 @@ class ECalibrationModelType(_IntEnum):
ECalibrationModelType.LENS_DISTORTION_MODEL_POLYNOMIAL_3K | Deprecated (not supported). Calibration model is Polynomial 3K.
ECalibrationModelType.LENS_DISTORTION_MODEL_RATIONAL_6KT | Deprecated (only supported early internal devices). Calibration model is Rational 6KT.
ECalibrationModelType.LENS_DISTORTION_MODEL_BROWN_CONRADY | Calibration model is Brown Conrady (compatible with OpenCV).
- '''
+ """
LENS_DISTORTION_MODEL_UNKNOWN = 0
LENS_DISTORTION_MODEL_THETA = _auto()
LENS_DISTORTION_MODEL_POLYNOMIAL_3K = _auto()
@@ -494,110 +491,116 @@ class ECalibrationModelType(_IntEnum):
@_unique
class EFirmwareBuild(_IntEnum):
- '''! Firmware build type.
+ """! Firmware build type.
Name | Description
------------------------------- | -----------------------------------------
EFirmwareBuild.RELEASE | Production firmware.
EFirmwareBuild.DEBUG | Pre-production firmware.
- '''
+ """
RELEASE = 0
DEBUG = _auto()
@_unique
class EFirmwareSignature(_IntEnum):
- '''! Firmware signature type.
+ """! Firmware signature type.
Name | Description
------------------------------- | -----------------------------------------
EFirmwareSignature.MSFT | Microsoft signed firmware.
EFirmwareSignature.TEST | Test signed firmware.
EFirmwareSignature.UNSIGNED | Unsigned firmware.
- '''
+ """
MSFT = 0
TEST = _auto()
UNSIGNED = _auto()
-#define K4A_SUCCEEDED(_result_) (_result_ == SUCCEEDED)
-def K4A_SUCCEEDED(result:EStatus):
- '''! Validate that an EStatus is successful.
+# define K4A_SUCCEEDED(_result_) (_result_ == SUCCEEDED)
+def K4A_SUCCEEDED(result: EStatus):
+ """! Validate that an EStatus is successful.
+
+ @param result: (EStatus): An EStatus returned by some functions in the K4A API.
- @param result (EStatus): An EStatus returned by some functions in the K4A API.
-
@returns True if result is a successful status, False otherwise.
- '''
+ """
return result == EStatus.SUCCEEDED
-#define K4A_FAILED(_result_) (!K4A_SUCCEEDED(_result_))
+# define K4A_FAILED(_result_) (!K4A_SUCCEEDED(_result_))
def K4A_FAILED(result):
- '''! Validate that an EStatus is failed.
+ """! Validate that an EStatus is failed.
+
+ @param result: (EStatus): An EStatus returned by some functions in the K4A API.
- @param result (EStatus): An EStatus returned by some functions in the K4A API.
-
@returns True if result is a failed status, False otherwise.
- '''
+ """
return not K4A_SUCCEEDED(result)
-#typedef void(k4a_logging_message_cb_t)(void *context,
+# typedef void(k4a_logging_message_cb_t)(void *context,
# ELogLevel level,
# const char *file,
# const int line,
# const char *message);
logging_message_cb = _FUNCTYPE(None,
- _ctypes.c_void_p, _ctypes.c_int, _ctypes.POINTER(_ctypes.c_char),
- _ctypes.c_int, _ctypes.POINTER(_ctypes.c_char))
-
+ _ctypes.c_void_p, _ctypes.c_int, _ctypes.POINTER(_ctypes.c_char),
+ _ctypes.c_int, _ctypes.POINTER(_ctypes.c_char))
-#typedef void(k4a_memory_destroy_cb_t)(void *buffer, void *context);
+# typedef void(k4a_memory_destroy_cb_t)(void *buffer, void *context);
_memory_destroy_cb = _FUNCTYPE(
None, _ctypes.c_void_p, _ctypes.c_void_p)
-
-#typedef uint8_t *(k4a_memory_allocate_cb_t)(int size, void **context);
+# typedef uint8_t *(k4a_memory_allocate_cb_t)(int size, void **context);
_memory_allocate_cb = _FUNCTYPE(
_ctypes.c_uint8, _ctypes.c_int, _ctypes.POINTER(_ctypes.c_void_p))
# K4A_DECLARE_HANDLE(handle_k4a_device_t);
class __handle_k4a_device_t(_ctypes.Structure):
- _fields_= [
+ _fields_ = [
("_rsvd", _ctypes.c_size_t),
]
+
+
_DeviceHandle = _ctypes.POINTER(__handle_k4a_device_t)
# K4A_DECLARE_HANDLE(handle_k4a_capture_t);
class __handle_k4a_capture_t(_ctypes.Structure):
- _fields_= [
+ _fields_ = [
("_rsvd", _ctypes.c_size_t),
]
+
+
_CaptureHandle = _ctypes.POINTER(__handle_k4a_capture_t)
# K4A_DECLARE_HANDLE(handle_k4a_image_t);
class __handle_k4a_image_t(_ctypes.Structure):
- _fields_= [
+ _fields_ = [
("_rsvd", _ctypes.c_size_t),
]
+
+
_ImageHandle = _ctypes.POINTER(__handle_k4a_image_t)
# K4A_DECLARE_HANDLE(k4a_transformation_t);
class __handle_k4a_transformation_t(_ctypes.Structure):
- _fields_= [
+ _fields_ = [
("_rsvd", _ctypes.c_size_t),
]
+
+
_TransformationHandle = _ctypes.POINTER(__handle_k4a_transformation_t)
class DeviceConfiguration(_ctypes.Structure):
- '''! Configuration parameters for an Azure Kinect device.
+ """! Configuration parameters for an Azure Kinect device.
- @remarks
+ @remarks
- Used by Device.start_cameras() to specify the configuration of the
data capture.
@@ -605,7 +608,7 @@ class DeviceConfiguration(_ctypes.Structure):
Field Name | Type | Description |
-
+
color_format |
EImageFormat |
@@ -649,8 +652,8 @@ class DeviceConfiguration(_ctypes.Structure):
color and depth images. If set to False, Capture objects may be
produced with only a single image when the corresponding image is
dropped.
- - Setting this to False ensures that the caller receives all of the
- images received from the camera, regardless of whether the
+ - Setting this to False ensures that the caller receives all the
+ images received from the camera, regardless of whether the
corresponding images expected in the capture are available.
- If either the color or depth camera are disabled, this setting has
no effect.
@@ -660,7 +663,7 @@ class DeviceConfiguration(_ctypes.Structure):
depth_delay_off_color_usec |
int |
- Desired delay in microseconds between the capture of the color image
+ | Desired delay in microseconds between the capture of the color image
and the capture of the depth image.
- A negative value indicates that the depth image should be captured
before the color image.
@@ -683,7 +686,7 @@ class DeviceConfiguration(_ctypes.Structure):
the color camera capture and the external input pulse. A setting of
zero indicates that the master and subordinate color images should
be aligned.
- - This setting does not effect the 'Sync out' connection.
+ - This setting does not affect the 'Sync out' connection.
- This value must be positive and range from zero to one capture period.
- If this is not a subordinate, then this value is ignored.
|
@@ -697,10 +700,10 @@ class DeviceConfiguration(_ctypes.Structure):
- This setting disables that behavior and keeps the LED in an off state.
-
+
- '''
- _fields_= [
+ """
+ _fields_ = [
("color_format", _ctypes.c_int),
("color_resolution", _ctypes.c_int),
("depth_mode", _ctypes.c_int),
@@ -712,17 +715,17 @@ class DeviceConfiguration(_ctypes.Structure):
("disable_streaming_indicator", _ctypes.c_bool),
]
- def __init__(self,
- color_format:EImageFormat=EImageFormat.CUSTOM,
- color_resolution:EColorResolution=EColorResolution.RES_720P,
- depth_mode:EDepthMode=EDepthMode.OFF,
- camera_fps:EFramesPerSecond=EFramesPerSecond.FPS_5,
- synchronized_images_only:bool=True,
- depth_delay_off_color_usec:int=0,
- wired_sync_mode:EWiredSyncMode=EWiredSyncMode.STANDALONE,
- subordinate_delay_off_master_usec:int=0,
- disable_streaming_indicator:bool=False):
-
+ def __init__(self,
+ color_format: EImageFormat = EImageFormat.CUSTOM,
+ color_resolution: EColorResolution = EColorResolution.RES_720P,
+ depth_mode: EDepthMode = EDepthMode.OFF,
+ camera_fps: EFramesPerSecond = EFramesPerSecond.FPS_5,
+ synchronized_images_only: bool = True,
+ depth_delay_off_color_usec: int = 0,
+ wired_sync_mode: EWiredSyncMode = EWiredSyncMode.STANDALONE,
+ subordinate_delay_off_master_usec: int = 0,
+ disable_streaming_indicator: bool = False):
+ super().__init__()
self.color_format = color_format
self.color_resolution = color_resolution
self.depth_mode = depth_mode
@@ -756,9 +759,9 @@ def __str__(self):
class CalibrationExtrinsics(_ctypes.Structure):
- '''! Extrinsic calibration data.
+ """! Extrinsic calibration data.
- @remarks
+ @remarks
- Extrinsic calibration defines the physical relationship between
two separate devices.
@@ -766,8 +769,8 @@ class CalibrationExtrinsics(_ctypes.Structure):
------------- | ---------- | ----------------------------------------------
rotation | float * 9 | 3x3 Rotation matrix stored in row major order.
translation | float * 3 | Translation vector, x,y,z (in millimeters).
- '''
- _fields_= [
+ """
+ _fields_ = [
("rotation", (_ctypes.c_float * 3) * 3),
("translation", _ctypes.c_float * 3),
]
@@ -783,13 +786,13 @@ def __str__(self):
class CalibrationIntrinsicParam(_ctypes.Structure):
- '''! Camera intrinsic calibration data.
+ """! Camera intrinsic calibration data.
- @remarks
+ @remarks
- Intrinsic calibration represents the internal optical properties
of the camera.
- @remarks
+ @remarks
- Azure Kinect devices are calibrated with Brown Conrady which is
compatible with OpenCV.
@@ -810,7 +813,7 @@ class CalibrationIntrinsicParam(_ctypes.Structure):
p2 | float | Tangential distortion coefficient 2.
p1 | float | Tangential distortion coefficient 1.
metric_radius | float | Metric radius.
- '''
+ """
_fields_ = [
("cx", _ctypes.c_float),
("cy", _ctypes.c_float),
@@ -846,7 +849,7 @@ def __str__(self):
class _CalibrationIntrinsicParameters(_ctypes.Union):
- _fields_= [
+ _fields_ = [
("param", CalibrationIntrinsicParam),
("v", _ctypes.c_float * 15),
]
@@ -856,13 +859,13 @@ def __str__(self):
class CalibrationIntrinsics(_ctypes.Structure):
- '''! Camera sensor intrinsic calibration data.
+ """! Camera sensor intrinsic calibration data.
- @remarks
+ @remarks
- Intrinsic calibration represents the internal optical properties
of the camera.
- @remarks
+ @remarks
- Azure Kinect devices are calibrated with Brown Conrady which is
compatible with OpenCV.
@@ -871,8 +874,8 @@ class CalibrationIntrinsics(_ctypes.Structure):
type | ECalibrationType | Type of calibration model used.
parameter_count | int | Number of valid entries in parameters.
parameters | struct | Calibration parameters.
- '''
- _fields_= [
+ """
+ _fields_ = [
("type", _ctypes.c_int),
("parameter_count", _ctypes.c_uint),
("parameters", _CalibrationIntrinsicParameters),
@@ -889,7 +892,7 @@ def __str__(self):
class CalibrationCamera(_ctypes.Structure):
- '''! Camera calibration contains intrinsic and extrinsic calibration
+ """! Camera calibration contains intrinsic and extrinsic calibration
information for a camera.
Name | Type | Description
@@ -899,8 +902,8 @@ class CalibrationCamera(_ctypes.Structure):
resolution_width | int | Resolution width of the calibration sensor.
resolution_height | int | Resolution height of the calibration sensor.
metric_radius | float | Max FOV of the camera.
- '''
- _fields_= [
+ """
+ _fields_ = [
("extrinsics", CalibrationExtrinsics),
("intrinsics", CalibrationIntrinsics),
("resolution_width", _ctypes.c_int),
@@ -914,7 +917,7 @@ def __str__(self):
'intrinsics=%s, ',
'resolution_width=%d, ',
'resolution_height=%d, ',
- 'metric_radius=%f',]) % (
+ 'metric_radius=%f', ]) % (
self.extrinsics.__str__(),
self.intrinsics.__str__(),
self.resolution_width,
@@ -923,7 +926,7 @@ def __str__(self):
class _Calibration(_ctypes.Structure):
- _fields_= [
+ _fields_ = [
("depth_camera_calibration", CalibrationCamera),
("color_camera_calibration", CalibrationCamera),
("extrinsics", (CalibrationExtrinsics * ECalibrationType.NUM_TYPES) * ECalibrationType.NUM_TYPES),
@@ -938,14 +941,14 @@ def __str__(self):
self.depth_camera_calibration.__str__(),
self.color_camera_calibration.__str__(),
)
-
+
for r in range(ECalibrationType.NUM_TYPES):
for c in range(ECalibrationType.NUM_TYPES):
s = ''.join([s, 'extrinsics[%d][%d]=%s, ']) % (r, c, self.extrinsics[r][c].__str__())
s = ''.join([s,
- 'depth_mode=%d, ',
- 'color_resolution=%d']) % (
+ 'depth_mode=%d, ',
+ 'color_resolution=%d']) % (
self.depth_mode,
self.color_resolution
)
@@ -954,15 +957,15 @@ def __str__(self):
class Version(_ctypes.Structure):
- '''! Version information.
+ """! Version information.
Name | Type | Description
---------- | ------- | ----------------------------------------------
major | int | Major version; represents a breaking change.
minor | int | Minor version; represents additional features, no regression from lower versions with same major version.
iteration | int | Reserved.
- '''
- _fields_= [
+ """
+ _fields_ = [
("major", _ctypes.c_uint32),
("minor", _ctypes.c_uint32),
("iteration", _ctypes.c_uint32),
@@ -976,7 +979,7 @@ def __str__(self):
class HardwareVersion(_ctypes.Structure):
- '''! Structure to define hardware version.
+ """! Structure to define hardware version.
Name | Type | Description
------------------ | ------- | ----------------------------------------------
@@ -986,8 +989,8 @@ class HardwareVersion(_ctypes.Structure):
depth | Version | Depth sensor firmware version.
firmware_build | int | Build type reported by the firmware.
firmware_signature | int | Signature type of the firmware.
- '''
- _fields_= [
+ """
+ _fields_ = [
("rgb", Version),
("depth", Version),
("audio", Version),
@@ -1013,12 +1016,13 @@ def __str__(self):
class _XY(_ctypes.Structure):
- _fields_= [
+ _fields_ = [
("x", _ctypes.c_float),
("y", _ctypes.c_float),
- ]
+ ]
def __init__(self, x=0, y=0):
+ super().__init__()
self.x = x
self.y = y
@@ -1027,12 +1031,13 @@ def __str__(self):
class _Float2(_ctypes.Union):
- _fields_= [
+ _fields_ = [
("xy", _XY),
("v", _ctypes.c_float * 2),
- ]
+ ]
def __init__(self, x=0, y=0):
+ super().__init__()
self.xy = _XY(x, y)
def __str__(self):
@@ -1040,13 +1045,14 @@ def __str__(self):
class _XYZ(_ctypes.Structure):
- _fields_= [
+ _fields_ = [
("x", _ctypes.c_float),
("y", _ctypes.c_float),
("z", _ctypes.c_float),
]
def __init__(self, x=0, y=0, z=0):
+ super().__init__()
self.x = x
self.y = y
self.z = z
@@ -1056,12 +1062,13 @@ def __str__(self):
class _Float3(_ctypes.Union):
- _fields_= [
+ _fields_ = [
("xyz", _XYZ),
("v", _ctypes.c_float * 3)
]
def __init__(self, x=0, y=0, z=0):
+ super().__init__()
self.xyz = _XYZ(x, y, z)
def __str__(self):
@@ -1069,7 +1076,7 @@ def __str__(self):
class ImuSample(_ctypes.Structure):
- '''! IMU Sample.
+ """! IMU Sample.
Name | Type | Description
------------------- | --------- | ----------------------------------------------
@@ -1078,8 +1085,8 @@ class ImuSample(_ctypes.Structure):
acc_timestamp_usec | int | Timestamp of the accelerometer in microseconds.
gyro_sample | float * 3 | Gyro sample in radians per second.
gyro_timestamp_usec | int | Timestamp of the gyroscope in microseconds.
- '''
- _fields_= [
+ """
+ _fields_ = [
("temperature", _ctypes.c_float),
("acc_sample", _Float3),
("acc_timestamp_usec", _ctypes.c_uint64),
@@ -1103,15 +1110,15 @@ def __str__(self):
# An empty class for appending fields dynamically.
class _EmptyClass:
-
+
def __str__(self):
keys = list(self.__dict__.keys())
tempstr = ''
if len(keys) > 0:
- for n in range(len(keys)-1):
+ for n in range(len(keys) - 1):
tempstr = tempstr + str(keys[n]) + "=" + str(self.__dict__[keys[n]]) + ", "
- tempstr = tempstr + str(keys[len(keys)-1]) + "=" + str(self.__dict__[keys[len(keys)-1]])
+ tempstr = tempstr + str(keys[len(keys) - 1]) + "=" + str(self.__dict__[keys[len(keys) - 1]])
return tempstr
@@ -1119,100 +1126,100 @@ def __str__(self):
# ############# Define global instances of device configurations. #############
DEVICE_CONFIG_DISABLE_ALL = DeviceConfiguration(
- color_format = EImageFormat.COLOR_MJPG,
- color_resolution = EColorResolution.OFF,
- depth_mode = EDepthMode.OFF,
- camera_fps = EFramesPerSecond.FPS_30,
- synchronized_images_only = False,
- depth_delay_off_color_usec = 0,
- wired_sync_mode = EWiredSyncMode.STANDALONE,
- subordinate_delay_off_master_usec = 0,
- disable_streaming_indicator = False)
+ color_format=EImageFormat.COLOR_MJPG,
+ color_resolution=EColorResolution.OFF,
+ depth_mode=EDepthMode.OFF,
+ camera_fps=EFramesPerSecond.FPS_30,
+ synchronized_images_only=False,
+ depth_delay_off_color_usec=0,
+ wired_sync_mode=EWiredSyncMode.STANDALONE,
+ subordinate_delay_off_master_usec=0,
+ disable_streaming_indicator=False)
DEVICE_CONFIG_BGRA32_2160P_WFOV_UNBINNED_FPS15 = DeviceConfiguration(
- color_format = EImageFormat.COLOR_BGRA32,
- color_resolution = EColorResolution.RES_2160P,
- depth_mode = EDepthMode.WFOV_UNBINNED,
- camera_fps = EFramesPerSecond.FPS_15,
- synchronized_images_only = True,
- depth_delay_off_color_usec = 0,
- wired_sync_mode = EWiredSyncMode.STANDALONE,
- subordinate_delay_off_master_usec = 0,
- disable_streaming_indicator = False)
+ color_format=EImageFormat.COLOR_BGRA32,
+ color_resolution=EColorResolution.RES_2160P,
+ depth_mode=EDepthMode.WFOV_UNBINNED,
+ camera_fps=EFramesPerSecond.FPS_15,
+ synchronized_images_only=True,
+ depth_delay_off_color_usec=0,
+ wired_sync_mode=EWiredSyncMode.STANDALONE,
+ subordinate_delay_off_master_usec=0,
+ disable_streaming_indicator=False)
DEVICE_CONFIG_BGRA32_2160P_WFOV_2X2BINNED_FPS15 = DeviceConfiguration(
- color_format = EImageFormat.COLOR_BGRA32,
- color_resolution = EColorResolution.RES_2160P,
- depth_mode = EDepthMode.WFOV_2X2BINNED,
- camera_fps = EFramesPerSecond.FPS_15,
- synchronized_images_only = True,
- depth_delay_off_color_usec = 0,
- wired_sync_mode = EWiredSyncMode.STANDALONE,
- subordinate_delay_off_master_usec = 0,
- disable_streaming_indicator = False)
+ color_format=EImageFormat.COLOR_BGRA32,
+ color_resolution=EColorResolution.RES_2160P,
+ depth_mode=EDepthMode.WFOV_2X2BINNED,
+ camera_fps=EFramesPerSecond.FPS_15,
+ synchronized_images_only=True,
+ depth_delay_off_color_usec=0,
+ wired_sync_mode=EWiredSyncMode.STANDALONE,
+ subordinate_delay_off_master_usec=0,
+ disable_streaming_indicator=False)
DEVICE_CONFIG_BGRA32_2160P_NFOV_UNBINNED_FPS15 = DeviceConfiguration(
- color_format = EImageFormat.COLOR_BGRA32,
- color_resolution = EColorResolution.RES_2160P,
- depth_mode = EDepthMode.NFOV_UNBINNED,
- camera_fps = EFramesPerSecond.FPS_15,
- synchronized_images_only = True,
- depth_delay_off_color_usec = 0,
- wired_sync_mode = EWiredSyncMode.STANDALONE,
- subordinate_delay_off_master_usec = 0,
- disable_streaming_indicator = False)
+ color_format=EImageFormat.COLOR_BGRA32,
+ color_resolution=EColorResolution.RES_2160P,
+ depth_mode=EDepthMode.NFOV_UNBINNED,
+ camera_fps=EFramesPerSecond.FPS_15,
+ synchronized_images_only=True,
+ depth_delay_off_color_usec=0,
+ wired_sync_mode=EWiredSyncMode.STANDALONE,
+ subordinate_delay_off_master_usec=0,
+ disable_streaming_indicator=False)
DEVICE_CONFIG_BGRA32_2160P_NFOV_2X2BINNED_FPS15 = DeviceConfiguration(
- color_format = EImageFormat.COLOR_BGRA32,
- color_resolution = EColorResolution.RES_2160P,
- depth_mode = EDepthMode.NFOV_2X2BINNED,
- camera_fps = EFramesPerSecond.FPS_15,
- synchronized_images_only = True,
- depth_delay_off_color_usec = 0,
- wired_sync_mode = EWiredSyncMode.STANDALONE,
- subordinate_delay_off_master_usec = 0,
- disable_streaming_indicator = False)
+ color_format=EImageFormat.COLOR_BGRA32,
+ color_resolution=EColorResolution.RES_2160P,
+ depth_mode=EDepthMode.NFOV_2X2BINNED,
+ camera_fps=EFramesPerSecond.FPS_15,
+ synchronized_images_only=True,
+ depth_delay_off_color_usec=0,
+ wired_sync_mode=EWiredSyncMode.STANDALONE,
+ subordinate_delay_off_master_usec=0,
+ disable_streaming_indicator=False)
DEVICE_CONFIG_BGRA32_1080P_WFOV_UNBINNED_FPS15 = DeviceConfiguration(
- color_format = EImageFormat.COLOR_BGRA32,
- color_resolution = EColorResolution.RES_1080P,
- depth_mode = EDepthMode.WFOV_UNBINNED,
- camera_fps = EFramesPerSecond.FPS_15,
- synchronized_images_only = True,
- depth_delay_off_color_usec = 0,
- wired_sync_mode = EWiredSyncMode.STANDALONE,
- subordinate_delay_off_master_usec = 0,
- disable_streaming_indicator = False)
+ color_format=EImageFormat.COLOR_BGRA32,
+ color_resolution=EColorResolution.RES_1080P,
+ depth_mode=EDepthMode.WFOV_UNBINNED,
+ camera_fps=EFramesPerSecond.FPS_15,
+ synchronized_images_only=True,
+ depth_delay_off_color_usec=0,
+ wired_sync_mode=EWiredSyncMode.STANDALONE,
+ subordinate_delay_off_master_usec=0,
+ disable_streaming_indicator=False)
DEVICE_CONFIG_BGRA32_1080P_WFOV_2X2BINNED_FPS15 = DeviceConfiguration(
- color_format = EImageFormat.COLOR_BGRA32,
- color_resolution = EColorResolution.RES_1080P,
- depth_mode = EDepthMode.WFOV_2X2BINNED,
- camera_fps = EFramesPerSecond.FPS_15,
- synchronized_images_only = True,
- depth_delay_off_color_usec = 0,
- wired_sync_mode = EWiredSyncMode.STANDALONE,
- subordinate_delay_off_master_usec = 0,
- disable_streaming_indicator = False)
+ color_format=EImageFormat.COLOR_BGRA32,
+ color_resolution=EColorResolution.RES_1080P,
+ depth_mode=EDepthMode.WFOV_2X2BINNED,
+ camera_fps=EFramesPerSecond.FPS_15,
+ synchronized_images_only=True,
+ depth_delay_off_color_usec=0,
+ wired_sync_mode=EWiredSyncMode.STANDALONE,
+ subordinate_delay_off_master_usec=0,
+ disable_streaming_indicator=False)
DEVICE_CONFIG_BGRA32_1080P_NFOV_UNBINNED_FPS15 = DeviceConfiguration(
- color_format = EImageFormat.COLOR_BGRA32,
- color_resolution = EColorResolution.RES_1080P,
- depth_mode = EDepthMode.NFOV_UNBINNED,
- camera_fps = EFramesPerSecond.FPS_15,
- synchronized_images_only = True,
- depth_delay_off_color_usec = 0,
- wired_sync_mode = EWiredSyncMode.STANDALONE,
- subordinate_delay_off_master_usec = 0,
- disable_streaming_indicator = False)
+ color_format=EImageFormat.COLOR_BGRA32,
+ color_resolution=EColorResolution.RES_1080P,
+ depth_mode=EDepthMode.NFOV_UNBINNED,
+ camera_fps=EFramesPerSecond.FPS_15,
+ synchronized_images_only=True,
+ depth_delay_off_color_usec=0,
+ wired_sync_mode=EWiredSyncMode.STANDALONE,
+ subordinate_delay_off_master_usec=0,
+ disable_streaming_indicator=False)
DEVICE_CONFIG_BGRA32_1080P_NFOV_2X2BINNED_FPS15 = DeviceConfiguration(
- color_format = EImageFormat.COLOR_BGRA32,
- color_resolution = EColorResolution.RES_1080P,
- depth_mode = EDepthMode.NFOV_2X2BINNED,
- camera_fps = EFramesPerSecond.FPS_15,
- synchronized_images_only = True,
- depth_delay_off_color_usec = 0,
- wired_sync_mode = EWiredSyncMode.STANDALONE,
- subordinate_delay_off_master_usec = 0,
- disable_streaming_indicator = False)
+ color_format=EImageFormat.COLOR_BGRA32,
+ color_resolution=EColorResolution.RES_1080P,
+ depth_mode=EDepthMode.NFOV_2X2BINNED,
+ camera_fps=EFramesPerSecond.FPS_15,
+ synchronized_images_only=True,
+ depth_delay_off_color_usec=0,
+ wired_sync_mode=EWiredSyncMode.STANDALONE,
+ subordinate_delay_off_master_usec=0,
+ disable_streaming_indicator=False)
diff --git a/src/python/k4a/src/k4a/_bindings/transformation.py b/src/python/k4a/src/k4a/_bindings/transformation.py
index 6be4bd872..3887a14e2 100644
--- a/src/python/k4a/src/k4a/_bindings/transformation.py
+++ b/src/python/k4a/src/k4a/_bindings/transformation.py
@@ -368,7 +368,7 @@ def color_2d_to_depth_2d(self,
_ctypes.byref(tgt_pt),
_ctypes.byref(valid_int_flag))
- if (status == EStatus.SUCCEEDED and valid_int_flag.value == 1):
+ if status == EStatus.SUCCEEDED and valid_int_flag.value == 1:
target_point = (tgt_pt.xy.x, tgt_pt.xy.y)
return target_point
@@ -410,7 +410,7 @@ def depth_image_to_color_camera(self, depth:Image)->Image:
depth._image_handle,
transformed_depth_image._image_handle)
- if (status != EStatus.SUCCEEDED):
+ if status != EStatus.SUCCEEDED:
transformed_depth_image = None
else:
buffer_ptr = k4a_image_get_buffer(transformed_depth_image._image_handle)
@@ -499,11 +499,11 @@ def depth_image_to_color_camera_custom(self,
interp_type,
_ctypes.c_uint32(invalid_value))
- if (status != EStatus.SUCCEEDED):
+ if status != EStatus.SUCCEEDED:
transformed_depth_image = None
transformed_custom_image = None
- return (transformed_depth_image, transformed_custom_image)
+ return transformed_depth_image, transformed_custom_image
def color_image_to_depth_camera(self,
depth:Image,
@@ -549,7 +549,7 @@ def color_image_to_depth_camera(self,
color._image_handle,
transformed_color_image._image_handle)
- if (status != EStatus.SUCCEEDED):
+ if status != EStatus.SUCCEEDED:
transformed_color_image = None
return transformed_color_image
@@ -601,7 +601,7 @@ def depth_image_to_point_cloud(self,
camera_type,
point_cloud_image._image_handle)
- if (status != EStatus.SUCCEEDED):
+ if status != EStatus.SUCCEEDED:
point_cloud_image = None
else:
# The ndarray for a CUSTOM image format is a flat buffer.