Azure Kinect Sensor SDK  refs/heads/release/1.4.x
Documentation for https://github.com/Microsoft/Azure-Kinect-Sensor-SDK
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 
636  int width_pixels,
637  int height_pixels,
638  int stride_bytes,
639  k4a_image_t *image_handle);
640 
698  int width_pixels,
699  int height_pixels,
700  int stride_bytes,
701  uint8_t *buffer,
702  size_t buffer_size,
703  k4a_memory_destroy_cb_t *buffer_release_cb,
704  void *buffer_release_cb_context,
705  k4a_image_t *image_handle);
706 
730 K4A_EXPORT uint8_t *k4a_image_get_buffer(k4a_image_t image_handle);
731 
755 K4A_EXPORT size_t k4a_image_get_size(k4a_image_t image_handle);
756 
779 K4A_EXPORT k4a_image_format_t k4a_image_get_format(k4a_image_t image_handle);
780 
800 K4A_EXPORT int k4a_image_get_width_pixels(k4a_image_t image_handle);
801 
821 K4A_EXPORT int k4a_image_get_height_pixels(k4a_image_t image_handle);
822 
842 K4A_EXPORT int k4a_image_get_stride_bytes(k4a_image_t image_handle);
843 
871 K4A_DEPRECATED_EXPORT uint64_t k4a_image_get_timestamp_usec(k4a_image_t image_handle);
872 
897 K4A_EXPORT uint64_t k4a_image_get_device_timestamp_usec(k4a_image_t image_handle);
898 
932 K4A_EXPORT uint64_t k4a_image_get_system_timestamp_nsec(k4a_image_t image_handle);
933 
956 K4A_EXPORT uint64_t k4a_image_get_exposure_usec(k4a_image_t image_handle);
957 
980 K4A_EXPORT uint32_t k4a_image_get_white_balance(k4a_image_t image_handle);
981 
1003 K4A_EXPORT uint32_t k4a_image_get_iso_speed(k4a_image_t image_handle);
1004 
1030 K4A_EXPORT void k4a_image_set_device_timestamp_usec(k4a_image_t image_handle, uint64_t timestamp_usec);
1031 
1060 K4A_DEPRECATED_EXPORT void k4a_image_set_timestamp_usec(k4a_image_t image_handle, uint64_t timestamp_usec);
1061 
1088 K4A_EXPORT void k4a_image_set_system_timestamp_nsec(k4a_image_t image_handle, uint64_t timestamp_nsec);
1089 
1113 K4A_EXPORT void k4a_image_set_exposure_usec(k4a_image_t image_handle, uint64_t exposure_usec);
1114 
1141 K4A_DEPRECATED_EXPORT void k4a_image_set_exposure_time_usec(k4a_image_t image_handle, uint64_t exposure_usec);
1142 
1166 K4A_EXPORT void k4a_image_set_white_balance(k4a_image_t image_handle, uint32_t white_balance);
1167 
1190 K4A_EXPORT void k4a_image_set_iso_speed(k4a_image_t image_handle, uint32_t iso_speed);
1191 
1211 K4A_EXPORT void k4a_image_reference(k4a_image_t image_handle);
1212 
1232 K4A_EXPORT void k4a_image_release(k4a_image_t image_handle);
1233 
1262 K4A_EXPORT k4a_result_t k4a_device_start_cameras(k4a_device_t device_handle, const k4a_device_configuration_t *config);
1263 
1287 K4A_EXPORT void k4a_device_stop_cameras(k4a_device_t device_handle);
1288 
1316 K4A_EXPORT k4a_result_t k4a_device_start_imu(k4a_device_t device_handle);
1317 
1341 K4A_EXPORT void k4a_device_stop_imu(k4a_device_t device_handle);
1342 
1382  char *serial_number,
1383  size_t *serial_number_size);
1384 
1406 K4A_EXPORT k4a_result_t k4a_device_get_version(k4a_device_t device_handle, k4a_hardware_version_t *version);
1407 
1450  bool *supports_auto,
1451  int32_t *min_value,
1452  int32_t *max_value,
1453  int32_t *step_value,
1454  int32_t *default_value,
1455  k4a_color_control_mode_t *default_mode);
1456 
1499 K4A_EXPORT k4a_result_t k4a_device_get_color_control(k4a_device_t device_handle,
1502  int32_t *value);
1503 
1544 K4A_EXPORT k4a_result_t k4a_device_set_color_control(k4a_device_t device_handle,
1547  int32_t value);
1548 
1579  uint8_t *data,
1580  size_t *data_size);
1581 
1621 K4A_EXPORT k4a_result_t k4a_device_get_calibration(k4a_device_t device_handle,
1622  const k4a_depth_mode_t depth_mode,
1623  const k4a_color_resolution_t color_resolution,
1624  k4a_calibration_t *calibration);
1625 
1658 K4A_EXPORT k4a_result_t k4a_device_get_sync_jack(k4a_device_t device_handle,
1659  bool *sync_in_jack_connected,
1660  bool *sync_out_jack_connected);
1661 
1704 K4A_EXPORT k4a_result_t k4a_calibration_get_from_raw(char *raw_calibration,
1705  size_t raw_calibration_size,
1706  const k4a_depth_mode_t depth_mode,
1707  const k4a_color_resolution_t color_resolution,
1708  k4a_calibration_t *calibration);
1709 
1748 K4A_EXPORT k4a_result_t k4a_calibration_3d_to_3d(const k4a_calibration_t *calibration,
1749  const k4a_float3_t *source_point3d_mm,
1750  const k4a_calibration_type_t source_camera,
1751  const k4a_calibration_type_t target_camera,
1752  k4a_float3_t *target_point3d_mm);
1753 
1809 K4A_EXPORT k4a_result_t k4a_calibration_2d_to_3d(const k4a_calibration_t *calibration,
1810  const k4a_float2_t *source_point2d,
1811  const float source_depth_mm,
1812  const k4a_calibration_type_t source_camera,
1813  const k4a_calibration_type_t target_camera,
1814  k4a_float3_t *target_point3d_mm,
1815  int *valid);
1816 
1865 K4A_EXPORT k4a_result_t k4a_calibration_3d_to_2d(const k4a_calibration_t *calibration,
1866  const k4a_float3_t *source_point3d_mm,
1867  const k4a_calibration_type_t source_camera,
1868  const k4a_calibration_type_t target_camera,
1869  k4a_float2_t *target_point2d,
1870  int *valid);
1871 
1928 K4A_EXPORT k4a_result_t k4a_calibration_2d_to_2d(const k4a_calibration_t *calibration,
1929  const k4a_float2_t *source_point2d,
1930  const float source_depth_mm,
1931  const k4a_calibration_type_t source_camera,
1932  const k4a_calibration_type_t target_camera,
1933  k4a_float2_t *target_point2d,
1934  int *valid);
1935 
1984  const k4a_float2_t *source_point2d,
1985  const k4a_image_t depth_image,
1986  k4a_float2_t *target_point2d,
1987  int *valid);
1988 
2016 
2032 K4A_EXPORT void k4a_transformation_destroy(k4a_transformation_t transformation_handle);
2033 
2077  const k4a_image_t depth_image,
2078  k4a_image_t transformed_depth_image);
2079 
2156 K4A_EXPORT k4a_result_t
2158  const k4a_image_t depth_image,
2159  const k4a_image_t custom_image,
2160  k4a_image_t transformed_depth_image,
2161  k4a_image_t transformed_custom_image,
2162  k4a_transformation_interpolation_type_t interpolation_type,
2163  uint32_t invalid_custom_value);
2164 
2213  const k4a_image_t depth_image,
2214  const k4a_image_t color_image,
2215  k4a_image_t transformed_color_image);
2216 
2265  const k4a_image_t depth_image,
2266  const k4a_calibration_type_t camera,
2267  k4a_image_t xyz_image);
2268 
2273 #ifdef __cplusplus
2274 }
2275 #endif
2276 
2277 #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:1099
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_result_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, int *valid)
Transform a 2D pixel coordinate from color camera into a 2D pixel coordinate of the depth 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:1141
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:1199
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:892
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:1179
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:868
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:1160
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:842
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:917
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.