Azure Kinect Sensor SDK  refs/heads/feature/publishdocs
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 
126 K4A_EXPORT k4a_result_t k4a_device_open(uint32_t index, k4a_device_t *device_handle);
127 
148 K4A_EXPORT void k4a_device_close(k4a_device_t device_handle);
149 
209 K4A_EXPORT k4a_wait_result_t k4a_device_get_capture(k4a_device_t device_handle,
210  k4a_capture_t *capture_handle,
211  int32_t timeout_in_ms);
212 
268  k4a_imu_sample_t *imu_sample,
269  int32_t timeout_in_ms);
270 
295 K4A_EXPORT k4a_result_t k4a_capture_create(k4a_capture_t *capture_handle);
296 
315 K4A_EXPORT void k4a_capture_release(k4a_capture_t capture_handle);
316 
336 K4A_EXPORT void k4a_capture_reference(k4a_capture_t capture_handle);
337 
357 K4A_EXPORT k4a_image_t k4a_capture_get_color_image(k4a_capture_t capture_handle);
358 
378 K4A_EXPORT k4a_image_t k4a_capture_get_depth_image(k4a_capture_t capture_handle);
379 
399 K4A_EXPORT k4a_image_t k4a_capture_get_ir_image(k4a_capture_t capture_handle);
400 
435 K4A_EXPORT void k4a_capture_set_color_image(k4a_capture_t capture_handle, k4a_image_t image_handle);
436 
471 K4A_EXPORT void k4a_capture_set_depth_image(k4a_capture_t capture_handle, k4a_image_t image_handle);
472 
506 K4A_EXPORT void k4a_capture_set_ir_image(k4a_capture_t capture_handle, k4a_image_t image_handle);
507 
526 K4A_EXPORT void k4a_capture_set_temperature_c(k4a_capture_t capture_handle, float temperature_c);
527 
547 K4A_EXPORT float k4a_capture_get_temperature_c(k4a_capture_t capture_handle);
548 
597  int width_pixels,
598  int height_pixels,
599  int stride_bytes,
600  k4a_image_t *image_handle);
601 
659  int width_pixels,
660  int height_pixels,
661  int stride_bytes,
662  uint8_t *buffer,
663  size_t buffer_size,
664  k4a_memory_destroy_cb_t *buffer_release_cb,
665  void *buffer_release_cb_context,
666  k4a_image_t *image_handle);
667 
691 K4A_EXPORT uint8_t *k4a_image_get_buffer(k4a_image_t image_handle);
692 
716 K4A_EXPORT size_t k4a_image_get_size(k4a_image_t image_handle);
717 
740 K4A_EXPORT k4a_image_format_t k4a_image_get_format(k4a_image_t image_handle);
741 
761 K4A_EXPORT int k4a_image_get_width_pixels(k4a_image_t image_handle);
762 
782 K4A_EXPORT int k4a_image_get_height_pixels(k4a_image_t image_handle);
783 
803 K4A_EXPORT int k4a_image_get_stride_bytes(k4a_image_t image_handle);
804 
829 K4A_EXPORT uint64_t k4a_image_get_timestamp_usec(k4a_image_t image_handle);
830 
853 K4A_EXPORT uint64_t k4a_image_get_exposure_usec(k4a_image_t image_handle);
854 
877 K4A_EXPORT uint32_t k4a_image_get_white_balance(k4a_image_t image_handle);
878 
900 K4A_EXPORT uint32_t k4a_image_get_iso_speed(k4a_image_t image_handle);
901 
927 K4A_EXPORT void k4a_image_set_timestamp_usec(k4a_image_t image_handle, uint64_t timestamp_usec);
928 
952 K4A_EXPORT void k4a_image_set_exposure_time_usec(k4a_image_t image_handle, uint64_t exposure_usec);
953 
977 K4A_EXPORT void k4a_image_set_white_balance(k4a_image_t image_handle, uint32_t white_balance);
978 
1001 K4A_EXPORT void k4a_image_set_iso_speed(k4a_image_t image_handle, uint32_t iso_speed);
1002 
1022 K4A_EXPORT void k4a_image_reference(k4a_image_t image_handle);
1023 
1043 K4A_EXPORT void k4a_image_release(k4a_image_t image_handle);
1044 
1074 
1098 K4A_EXPORT void k4a_device_stop_cameras(k4a_device_t device_handle);
1099 
1127 K4A_EXPORT k4a_result_t k4a_device_start_imu(k4a_device_t device_handle);
1128 
1152 K4A_EXPORT void k4a_device_stop_imu(k4a_device_t device_handle);
1153 
1193  char *serial_number,
1194  size_t *serial_number_size);
1195 
1217 K4A_EXPORT k4a_result_t k4a_device_get_version(k4a_device_t device_handle, k4a_hardware_version_t *version);
1218 
1261  bool *supports_auto,
1262  int32_t *min_value,
1263  int32_t *max_value,
1264  int32_t *step_value,
1265  int32_t *default_value,
1266  k4a_color_control_mode_t *default_mode);
1267 
1310 K4A_EXPORT k4a_result_t k4a_device_get_color_control(k4a_device_t device_handle,
1313  int32_t *value);
1314 
1355 K4A_EXPORT k4a_result_t k4a_device_set_color_control(k4a_device_t device_handle,
1358  int32_t value);
1359 
1390  uint8_t *data,
1391  size_t *data_size);
1392 
1432 K4A_EXPORT k4a_result_t k4a_device_get_calibration(k4a_device_t device_handle,
1433  const k4a_depth_mode_t depth_mode,
1434  const k4a_color_resolution_t color_resolution,
1435  k4a_calibration_t *calibration);
1436 
1469 K4A_EXPORT k4a_result_t k4a_device_get_sync_jack(k4a_device_t device_handle,
1470  bool *sync_in_jack_connected,
1471  bool *sync_out_jack_connected);
1472 
1515 K4A_EXPORT k4a_result_t k4a_calibration_get_from_raw(char *raw_calibration,
1516  size_t raw_calibration_size,
1517  const k4a_depth_mode_t depth_mode,
1518  const k4a_color_resolution_t color_resolution,
1519  k4a_calibration_t *calibration);
1520 
1559 K4A_EXPORT k4a_result_t k4a_calibration_3d_to_3d(const k4a_calibration_t *calibration,
1560  const k4a_float3_t *source_point3d_mm,
1561  const k4a_calibration_type_t source_camera,
1562  const k4a_calibration_type_t target_camera,
1563  k4a_float3_t *target_point3d_mm);
1564 
1619 K4A_EXPORT k4a_result_t k4a_calibration_2d_to_3d(const k4a_calibration_t *calibration,
1620  const k4a_float2_t *source_point2d,
1621  const float source_depth_mm,
1622  const k4a_calibration_type_t source_camera,
1623  const k4a_calibration_type_t target_camera,
1624  k4a_float3_t *target_point3d_mm,
1625  int *valid);
1626 
1675 K4A_EXPORT k4a_result_t k4a_calibration_3d_to_2d(const k4a_calibration_t *calibration,
1676  const k4a_float3_t *source_point3d_mm,
1677  const k4a_calibration_type_t source_camera,
1678  const k4a_calibration_type_t target_camera,
1679  k4a_float2_t *target_point2d,
1680  int *valid);
1681 
1737 K4A_EXPORT k4a_result_t k4a_calibration_2d_to_2d(const k4a_calibration_t *calibration,
1738  const k4a_float2_t *source_point2d,
1739  const float source_depth_mm,
1740  const k4a_calibration_type_t source_camera,
1741  const k4a_calibration_type_t target_camera,
1742  k4a_float2_t *target_point2d,
1743  int *valid);
1744 
1772 
1788 K4A_EXPORT void k4a_transformation_destroy(k4a_transformation_t transformation_handle);
1789 
1833  const k4a_image_t depth_image,
1834  k4a_image_t transformed_depth_image);
1835 
1884  const k4a_image_t depth_image,
1885  const k4a_image_t color_image,
1886  k4a_image_t transformed_color_image);
1887 
1936  const k4a_image_t depth_image,
1937  const k4a_calibration_type_t camera,
1938  k4a_image_t xyz_image);
1939 
1944 #ifdef __cplusplus
1945 }
1946 #endif
1947 
1948 #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:1014
uint32_t k4a_image_get_white_balance(k4a_image_t image_handle)
Get the image white balance.
k4a_transformation_t k4a_transformation_create(const k4a_calibration_t *calibration)
Get handle to transformation handle.
Structure to define hardware version.
Definition: k4atypes.h:1056
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 recieve debug messages from the Azure Kinect device...
int k4a_image_get_height_pixels(k4a_image_t image_handle)
Get the image height in pixels.
uint64_t k4a_image_get_timestamp_usec(k4a_image_t image_handle)
Get the image timestamp in microseconds.
k4a_depth_mode_t
Depth sensor capture modes.
Definition: k4atypes.h:289
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:1114
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.
void k4a_device_stop_imu(k4a_device_t device_handle)
Stops the IMU capture.
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:606
int k4a_image_get_stride_bytes(k4a_image_t image_handle)
Get the image stride in bytes.
k4a_result_t k4a_device_start_cameras(k4a_device_t device_handle, k4a_device_configuration_t *config)
Starts color and depth camera capture.
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_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:1094
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.
k4a_color_control_mode_t
Color sensor control mode.
Definition: k4atypes.h:572
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:307
void() k4a_memory_destroy_cb_t(void *buffer, void *context)
Callback function for a memory object being destroyed.
Definition: k4atypes.h:807
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_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.
Handle to an Azure Kinect device.
Definition: k4atypes.h:66
Two dimensional floating point vector.
Definition: k4atypes.h:1075
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:781
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:832
k4a_log_level_t
Verbosity levels of debug messaging.
Definition: k4atypes.h:261
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:461
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.
k4a_image_format_t k4a_image_get_format(k4a_image_t image_handle)
Get the format of the image.
void k4a_image_set_timestamp_usec(k4a_image_t image_handle, uint64_t timestamp_usec)
Set the time stamp, in microseconds, 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:329
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.