Azure Kinect Sensor SDK  refs/heads/release/1.2.x
Documentation for https://github.com/Microsoft/Azure-Kinect-Sensor-SDK
All Data Structures Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Modules Pages
k4a.h
1 
7 #ifndef K4A_H
8 #define K4A_H
9 
10 #ifdef __cplusplus
11 #include <cinttypes>
12 #else
13 #include <inttypes.h>
14 #endif
15 #include <k4a/k4aversion.h>
16 #include <k4a/k4atypes.h>
17 #include <k4a/k4a_export.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
49 K4A_EXPORT uint32_t k4a_device_get_installed_count(void);
50 
96  void *message_cb_context,
97  k4a_log_level_t min_level);
98 
134 
162 K4A_EXPORT k4a_result_t k4a_device_open(uint32_t index, k4a_device_t *device_handle);
163 
184 K4A_EXPORT void k4a_device_close(k4a_device_t device_handle);
185 
245 K4A_EXPORT k4a_wait_result_t k4a_device_get_capture(k4a_device_t device_handle,
246  k4a_capture_t *capture_handle,
247  int32_t timeout_in_ms);
248 
304  k4a_imu_sample_t *imu_sample,
305  int32_t timeout_in_ms);
306 
331 K4A_EXPORT k4a_result_t k4a_capture_create(k4a_capture_t *capture_handle);
332 
351 K4A_EXPORT void k4a_capture_release(k4a_capture_t capture_handle);
352 
372 K4A_EXPORT void k4a_capture_reference(k4a_capture_t capture_handle);
373 
393 K4A_EXPORT k4a_image_t k4a_capture_get_color_image(k4a_capture_t capture_handle);
394 
414 K4A_EXPORT k4a_image_t k4a_capture_get_depth_image(k4a_capture_t capture_handle);
415 
435 K4A_EXPORT k4a_image_t k4a_capture_get_ir_image(k4a_capture_t capture_handle);
436 
471 K4A_EXPORT void k4a_capture_set_color_image(k4a_capture_t capture_handle, k4a_image_t image_handle);
472 
507 K4A_EXPORT void k4a_capture_set_depth_image(k4a_capture_t capture_handle, k4a_image_t image_handle);
508 
542 K4A_EXPORT void k4a_capture_set_ir_image(k4a_capture_t capture_handle, k4a_image_t image_handle);
543 
562 K4A_EXPORT void k4a_capture_set_temperature_c(k4a_capture_t capture_handle, float temperature_c);
563 
583 K4A_EXPORT float k4a_capture_get_temperature_c(k4a_capture_t capture_handle);
584 
635  int width_pixels,
636  int height_pixels,
637  int stride_bytes,
638  k4a_image_t *image_handle);
639 
697  int width_pixels,
698  int height_pixels,
699  int stride_bytes,
700  uint8_t *buffer,
701  size_t buffer_size,
702  k4a_memory_destroy_cb_t *buffer_release_cb,
703  void *buffer_release_cb_context,
704  k4a_image_t *image_handle);
705 
729 K4A_EXPORT uint8_t *k4a_image_get_buffer(k4a_image_t image_handle);
730 
754 K4A_EXPORT size_t k4a_image_get_size(k4a_image_t image_handle);
755 
778 K4A_EXPORT k4a_image_format_t k4a_image_get_format(k4a_image_t image_handle);
779 
799 K4A_EXPORT int k4a_image_get_width_pixels(k4a_image_t image_handle);
800 
820 K4A_EXPORT int k4a_image_get_height_pixels(k4a_image_t image_handle);
821 
841 K4A_EXPORT int k4a_image_get_stride_bytes(k4a_image_t image_handle);
842 
870 K4A_DEPRECATED_EXPORT uint64_t k4a_image_get_timestamp_usec(k4a_image_t image_handle);
871 
896 K4A_EXPORT uint64_t k4a_image_get_device_timestamp_usec(k4a_image_t image_handle);
897 
931 K4A_EXPORT uint64_t k4a_image_get_system_timestamp_nsec(k4a_image_t image_handle);
932 
955 K4A_EXPORT uint64_t k4a_image_get_exposure_usec(k4a_image_t image_handle);
956 
979 K4A_EXPORT uint32_t k4a_image_get_white_balance(k4a_image_t image_handle);
980 
1002 K4A_EXPORT uint32_t k4a_image_get_iso_speed(k4a_image_t image_handle);
1003 
1029 K4A_EXPORT void k4a_image_set_device_timestamp_usec(k4a_image_t image_handle, uint64_t timestamp_usec);
1030 
1059 K4A_DEPRECATED_EXPORT void k4a_image_set_timestamp_usec(k4a_image_t image_handle, uint64_t timestamp_usec);
1060 
1087 K4A_EXPORT void k4a_image_set_system_timestamp_nsec(k4a_image_t image_handle, uint64_t timestamp_nsec);
1088 
1112 K4A_EXPORT void k4a_image_set_exposure_usec(k4a_image_t image_handle, uint64_t exposure_usec);
1113 
1140 K4A_DEPRECATED_EXPORT void k4a_image_set_exposure_time_usec(k4a_image_t image_handle, uint64_t exposure_usec);
1141 
1165 K4A_EXPORT void k4a_image_set_white_balance(k4a_image_t image_handle, uint32_t white_balance);
1166 
1189 K4A_EXPORT void k4a_image_set_iso_speed(k4a_image_t image_handle, uint32_t iso_speed);
1190 
1210 K4A_EXPORT void k4a_image_reference(k4a_image_t image_handle);
1211 
1231 K4A_EXPORT void k4a_image_release(k4a_image_t image_handle);
1232 
1261 K4A_EXPORT k4a_result_t k4a_device_start_cameras(k4a_device_t device_handle, const k4a_device_configuration_t *config);
1262 
1286 K4A_EXPORT void k4a_device_stop_cameras(k4a_device_t device_handle);
1287 
1315 K4A_EXPORT k4a_result_t k4a_device_start_imu(k4a_device_t device_handle);
1316 
1340 K4A_EXPORT void k4a_device_stop_imu(k4a_device_t device_handle);
1341 
1381  char *serial_number,
1382  size_t *serial_number_size);
1383 
1405 K4A_EXPORT k4a_result_t k4a_device_get_version(k4a_device_t device_handle, k4a_hardware_version_t *version);
1406 
1449  bool *supports_auto,
1450  int32_t *min_value,
1451  int32_t *max_value,
1452  int32_t *step_value,
1453  int32_t *default_value,
1454  k4a_color_control_mode_t *default_mode);
1455 
1498 K4A_EXPORT k4a_result_t k4a_device_get_color_control(k4a_device_t device_handle,
1501  int32_t *value);
1502 
1543 K4A_EXPORT k4a_result_t k4a_device_set_color_control(k4a_device_t device_handle,
1546  int32_t value);
1547 
1578  uint8_t *data,
1579  size_t *data_size);
1580 
1620 K4A_EXPORT k4a_result_t k4a_device_get_calibration(k4a_device_t device_handle,
1621  const k4a_depth_mode_t depth_mode,
1622  const k4a_color_resolution_t color_resolution,
1623  k4a_calibration_t *calibration);
1624 
1657 K4A_EXPORT k4a_result_t k4a_device_get_sync_jack(k4a_device_t device_handle,
1658  bool *sync_in_jack_connected,
1659  bool *sync_out_jack_connected);
1660 
1703 K4A_EXPORT k4a_result_t k4a_calibration_get_from_raw(char *raw_calibration,
1704  size_t raw_calibration_size,
1705  const k4a_depth_mode_t depth_mode,
1706  const k4a_color_resolution_t color_resolution,
1707  k4a_calibration_t *calibration);
1708 
1747 K4A_EXPORT k4a_result_t k4a_calibration_3d_to_3d(const k4a_calibration_t *calibration,
1748  const k4a_float3_t *source_point3d_mm,
1749  const k4a_calibration_type_t source_camera,
1750  const k4a_calibration_type_t target_camera,
1751  k4a_float3_t *target_point3d_mm);
1752 
1808 K4A_EXPORT k4a_result_t k4a_calibration_2d_to_3d(const k4a_calibration_t *calibration,
1809  const k4a_float2_t *source_point2d,
1810  const float source_depth_mm,
1811  const k4a_calibration_type_t source_camera,
1812  const k4a_calibration_type_t target_camera,
1813  k4a_float3_t *target_point3d_mm,
1814  int *valid);
1815 
1864 K4A_EXPORT k4a_result_t k4a_calibration_3d_to_2d(const k4a_calibration_t *calibration,
1865  const k4a_float3_t *source_point3d_mm,
1866  const k4a_calibration_type_t source_camera,
1867  const k4a_calibration_type_t target_camera,
1868  k4a_float2_t *target_point2d,
1869  int *valid);
1870 
1927 K4A_EXPORT k4a_result_t k4a_calibration_2d_to_2d(const k4a_calibration_t *calibration,
1928  const k4a_float2_t *source_point2d,
1929  const float source_depth_mm,
1930  const k4a_calibration_type_t source_camera,
1931  const k4a_calibration_type_t target_camera,
1932  k4a_float2_t *target_point2d,
1933  int *valid);
1934 
1962 
1978 K4A_EXPORT void k4a_transformation_destroy(k4a_transformation_t transformation_handle);
1979 
2023  const k4a_image_t depth_image,
2024  k4a_image_t transformed_depth_image);
2025 
2102 K4A_EXPORT k4a_result_t
2104  const k4a_image_t depth_image,
2105  const k4a_image_t custom_image,
2106  k4a_image_t transformed_depth_image,
2107  k4a_image_t transformed_custom_image,
2108  k4a_transformation_interpolation_type_t interpolation_type,
2109  uint32_t invalid_custom_value);
2110 
2159  const k4a_image_t depth_image,
2160  const k4a_image_t color_image,
2161  k4a_image_t transformed_color_image);
2162 
2211  const k4a_image_t depth_image,
2212  const k4a_calibration_type_t camera,
2213  k4a_image_t xyz_image);
2214 
2219 #ifdef __cplusplus
2220 }
2221 #endif
2222 
2223 #endif /* K4A_H */
k4a_image_t k4a_capture_get_color_image(k4a_capture_t capture_handle)
Get the color image associated with the given capture.
k4a_result_t k4a_transformation_depth_image_to_point_cloud(k4a_transformation_t transformation_handle, const k4a_image_t depth_image, const k4a_calibration_type_t camera, k4a_image_t xyz_image)
Transforms the depth image into 3 planar images representing X, Y and Z-coordinates of corresponding ...
Calibration type representing device calibration.
Definition: k4atypes.h:1096
uint32_t k4a_image_get_white_balance(k4a_image_t image_handle)
Get the image white balance.
k4a_result_t k4a_transformation_depth_image_to_color_camera_custom(k4a_transformation_t transformation_handle, const k4a_image_t depth_image, const k4a_image_t custom_image, k4a_image_t transformed_depth_image, k4a_image_t transformed_custom_image, k4a_transformation_interpolation_type_t interpolation_type, uint32_t invalid_custom_value)
Transforms depth map and a custom image into the geometry of the color camera.
k4a_transformation_t k4a_transformation_create(const k4a_calibration_t *calibration)
Get handle to transformation handle.
Structure to define hardware version.
Definition: k4atypes.h:1138
uint32_t k4a_device_get_installed_count(void)
Gets the number of connected devices.
k4a_result_t k4a_device_start_imu(k4a_device_t device_handle)
Starts the IMU sample stream.
k4a_result_t
Result code returned by Azure Kinect APIs.
Definition: k4atypes.h:217
k4a_result_t k4a_set_debug_message_handler(k4a_logging_message_cb_t *message_cb, void *message_cb_context, k4a_log_level_t min_level)
Sets and clears the callback function to receive debug messages from the Azure Kinect device...
int k4a_image_get_height_pixels(k4a_image_t image_handle)
Get the image height in pixels.
k4a_depth_mode_t
Depth sensor capture modes.
Definition: k4atypes.h:290
k4a_result_t k4a_device_open(uint32_t index, k4a_device_t *device_handle)
Open an Azure Kinect device.
k4a_result_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)
Get the camera calibration for the entire Azure Kinect device.
Handle to an Azure Kinect capture.
Definition: k4atypes.h:122
k4a_result_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, int32_t *max_value, int32_t *step_value, int32_t *default_value, k4a_color_control_mode_t *default_mode)
Get the Azure Kinect color sensor control capabilities.
void k4a_capture_reference(k4a_capture_t capture_handle)
Add a reference to a capture.
k4a_buffer_result_t
Result code returned by Azure Kinect APIs.
Definition: k4atypes.h:231
uint8_t * k4a_image_get_buffer(k4a_image_t image_handle)
Get the image buffer.
k4a_image_t k4a_capture_get_ir_image(k4a_capture_t capture_handle)
Get the IR image associated with the given capture.
void k4a_image_set_iso_speed(k4a_image_t image_handle, uint32_t iso_speed)
Set the ISO speed of the image.
k4a_result_t k4a_capture_create(k4a_capture_t *capture_handle)
Create an empty capture object.
k4a_result_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)
Set the Azure Kinect color sensor control value.
void k4a_image_reference(k4a_image_t image_handle)
Add a reference to the k4a_image_t.
IMU sample.
Definition: k4atypes.h:1196
k4a_result_t k4a_device_get_version(k4a_device_t device_handle, k4a_hardware_version_t *version)
Get the version numbers of the device&#39;s subsystems.
int k4a_image_get_width_pixels(k4a_image_t image_handle)
Get the image width in pixels.
k4a_result_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)
Get the Azure Kinect color sensor control value.
k4a_transformation_interpolation_type_t
Transformation interpolation type.
Definition: k4atypes.h:459
void k4a_device_stop_imu(k4a_device_t device_handle)
Stops the IMU capture.
K4A_DEPRECATED_EXPORT void k4a_image_set_timestamp_usec(k4a_image_t image_handle, uint64_t timestamp_usec)
Set the device time stamp, in microseconds, of the image.
uint8_t *() k4a_memory_allocate_cb_t(int size, void **context)
Callback function for a memory allocation.
Definition: k4atypes.h:889
k4a_result_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, k4a_float2_t *target_point2d, int *valid)
Transform a 3D point of a source coordinate system into a 2D pixel coordinate of the target camera...
k4a_result_t k4a_transformation_depth_image_to_color_camera(k4a_transformation_t transformation_handle, const k4a_image_t depth_image, k4a_image_t transformed_depth_image)
Transforms the depth map into the geometry of the color camera.
k4a_calibration_type_t
Calibration types.
Definition: k4atypes.h:658
int k4a_image_get_stride_bytes(k4a_image_t image_handle)
Get the image stride in bytes.
uint64_t k4a_image_get_system_timestamp_nsec(k4a_image_t image_handle)
Get the image&#39;s system timestamp in nanoseconds.
void k4a_capture_set_temperature_c(k4a_capture_t capture_handle, float temperature_c)
Set the temperature associated with the capture.
k4a_result_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, const k4a_calibration_type_t target_camera, k4a_float2_t *target_point2d, int *valid)
Transform a 2D pixel coordinate with an associated depth value of the source camera into a 2D pixel c...
k4a_buffer_result_t k4a_device_get_raw_calibration(k4a_device_t device_handle, uint8_t *data, size_t *data_size)
Get the raw calibration blob for the entire Azure Kinect device.
k4a_image_t k4a_capture_get_depth_image(k4a_capture_t capture_handle)
Get the depth image associated with the given capture.
k4a_wait_result_t k4a_device_get_capture(k4a_device_t device_handle, k4a_capture_t *capture_handle, int32_t timeout_in_ms)
Reads a sensor capture.
K4A_DEPRECATED_EXPORT uint64_t k4a_image_get_timestamp_usec(k4a_image_t image_handle)
Get the image&#39;s device timestamp in microseconds.
k4a_result_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, k4a_float3_t *target_point3d_mm)
Transform a 3D point of a source coordinate system into a 3D point of the target coordinate system...
Three dimensional floating point vector.
Definition: k4atypes.h:1176
K4A_DEPRECATED_EXPORT void k4a_image_set_exposure_time_usec(k4a_image_t image_handle, uint64_t exposure_usec)
Set the exposure time, in microseconds, of the image.
void k4a_device_stop_cameras(k4a_device_t device_handle)
Stops the color and depth camera capture.
void k4a_image_set_exposure_usec(k4a_image_t image_handle, uint64_t exposure_usec)
Set the exposure time, in microseconds, of the image.
k4a_color_control_mode_t
Color sensor control mode.
Definition: k4atypes.h:622
void k4a_transformation_destroy(k4a_transformation_t transformation_handle)
Destroy transformation handle.
float k4a_capture_get_temperature_c(k4a_capture_t capture_handle)
Get the temperature associated with the capture.
Handle to an Azure Kinect transformation context.
Definition: k4atypes.h:195
k4a_color_resolution_t
Color sensor resolutions.
Definition: k4atypes.h:309
void() k4a_memory_destroy_cb_t(void *buffer, void *context)
Callback function for a memory object being destroyed.
Definition: k4atypes.h:865
k4a_result_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, const k4a_calibration_type_t target_camera, k4a_float3_t *target_point3d_mm, int *valid)
Transform a 2D pixel coordinate with an associated depth value of the source camera into a 3D point o...
void k4a_capture_set_depth_image(k4a_capture_t capture_handle, k4a_image_t image_handle)
Set or add a depth image to the associated capture.
k4a_result_t k4a_set_allocator(k4a_memory_allocate_cb_t allocate, k4a_memory_destroy_cb_t free)
Sets the callback functions for the SDK allocator.
k4a_result_t k4a_image_create_from_buffer(k4a_image_format_t format, int width_pixels, int height_pixels, int stride_bytes, uint8_t *buffer, size_t buffer_size, k4a_memory_destroy_cb_t *buffer_release_cb, void *buffer_release_cb_context, k4a_image_t *image_handle)
Create an image from a pre-allocated buffer.
k4a_wait_result_t k4a_device_get_imu_sample(k4a_device_t device_handle, k4a_imu_sample_t *imu_sample, int32_t timeout_in_ms)
Reads an IMU sample.
void k4a_image_set_white_balance(k4a_image_t image_handle, uint32_t white_balance)
Set the white balance of the image.
uint64_t k4a_image_get_exposure_usec(k4a_image_t image_handle)
Get the image exposure in microseconds.
uint64_t k4a_image_get_device_timestamp_usec(k4a_image_t image_handle)
Get the image&#39;s device timestamp in microseconds.
Handle to an Azure Kinect device.
Definition: k4atypes.h:66
Two dimensional floating point vector.
Definition: k4atypes.h:1157
void() k4a_logging_message_cb_t(void *context, k4a_log_level_t level, const char *file, const int line, const char *message)
Callback function for debug messages being generated by the Azure Kinect SDK.
Definition: k4atypes.h:839
Handle to an Azure Kinect image.
Definition: k4atypes.h:173
void k4a_device_close(k4a_device_t device_handle)
Closes an Azure Kinect device.
Configuration parameters for an Azure Kinect device.
Definition: k4atypes.h:914
void k4a_image_set_device_timestamp_usec(k4a_image_t image_handle, uint64_t timestamp_usec)
Set the device time stamp, in microseconds, of the image.
k4a_log_level_t
Verbosity levels of debug messaging.
Definition: k4atypes.h:261
k4a_result_t k4a_device_start_cameras(k4a_device_t device_handle, const k4a_device_configuration_t *config)
Starts color and depth camera capture.
void k4a_capture_set_color_image(k4a_capture_t capture_handle, k4a_image_t image_handle)
Set or add a color image to the associated capture.
k4a_color_control_command_t
Color sensor control commands.
Definition: k4atypes.h:503
void k4a_image_release(k4a_image_t image_handle)
Remove a reference from the k4a_image_t.
k4a_buffer_result_t k4a_device_get_serialnum(k4a_device_t device_handle, char *serial_number, size_t *serial_number_size)
Get the Azure Kinect device serial number.
void k4a_capture_release(k4a_capture_t capture_handle)
Release a capture.
size_t k4a_image_get_size(k4a_image_t image_handle)
Get the image buffer size.
k4a_wait_result_t
Result code returned by Azure Kinect APIs.
Definition: k4atypes.h:246
uint32_t k4a_image_get_iso_speed(k4a_image_t image_handle)
Get the image ISO speed.
void k4a_image_set_system_timestamp_nsec(k4a_image_t image_handle, uint64_t timestamp_nsec)
Set the system time stamp, in nanoseconds, of the image.
k4a_image_format_t k4a_image_get_format(k4a_image_t image_handle)
Get the format of the image.
k4a_result_t k4a_device_get_sync_jack(k4a_device_t device_handle, bool *sync_in_jack_connected, bool *sync_out_jack_connected)
Get the device jack status for the synchronization in and synchronization out connectors.
k4a_result_t k4a_image_create(k4a_image_format_t format, int width_pixels, int height_pixels, int stride_bytes, k4a_image_t *image_handle)
Create an image.
k4a_result_t k4a_transformation_color_image_to_depth_camera(k4a_transformation_t transformation_handle, const k4a_image_t depth_image, const k4a_image_t color_image, k4a_image_t transformed_color_image)
Transforms a color image into the geometry of the depth camera.
k4a_image_format_t
Image format type.
Definition: k4atypes.h:332
k4a_result_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)
Get the camera calibration for a device from a raw calibration blob.
void k4a_capture_set_ir_image(k4a_capture_t capture_handle, k4a_image_t image_handle)
Set or add an IR image to the associated capture.