33 class error :
public std::runtime_error
36 using runtime_error::runtime_error;
51 template<
typename output_type,
typename input_type> output_type clamp_cast(input_type input)
53 static_assert(std::is_arithmetic<input_type>::value,
"clamp_cast only supports arithmetic types");
54 static_assert(std::is_arithmetic<output_type>::value,
"clamp_cast only supports arithmetic types");
55 const input_type min_value = std::is_signed<input_type>() ?
56 static_cast<input_type>(std::numeric_limits<output_type>::min()) :
59 input_type max_value =
static_cast<input_type
>(std::numeric_limits<output_type>::max());
64 max_value = std::numeric_limits<input_type>::max();
66 input = std::min(input, max_value);
67 input = std::max(input, min_value);
68 return static_cast<output_type
>(input);
92 image(
const image &other) noexcept : m_handle(other.m_handle)
94 if (m_handle !=
nullptr)
96 k4a_image_reference(m_handle);
104 other.m_handle =
nullptr;
119 m_handle = other.m_handle;
120 if (m_handle !=
nullptr)
122 k4a_image_reference(m_handle);
135 m_handle = other.m_handle;
136 other.m_handle =
nullptr;
153 return m_handle == other.m_handle;
160 return m_handle ==
nullptr;
167 return m_handle != other.m_handle;
174 return m_handle !=
nullptr;
179 explicit operator bool() const noexcept
188 return m_handle !=
nullptr;
207 if (m_handle !=
nullptr)
209 k4a_image_release(m_handle);
222 k4a_result_t result = k4a_image_create(format, width_pixels, height_pixels, stride_bytes, &handle);
225 throw error(
"Failed to create image!");
227 return image(handle);
242 void *buffer_release_cb_context)
245 k4a_result_t result = k4a_image_create_from_buffer(format,
252 buffer_release_cb_context,
256 throw error(
"Failed to create image from buffer");
258 return image(handle);
267 return k4a_image_get_buffer(m_handle);
276 return k4a_image_get_buffer(m_handle);
285 return k4a_image_get_size(m_handle);
294 return k4a_image_get_format(m_handle);
303 return k4a_image_get_width_pixels(m_handle);
312 return k4a_image_get_height_pixels(m_handle);
321 return k4a_image_get_stride_bytes(m_handle);
330 return std::chrono::microseconds(k4a_image_get_device_timestamp_usec(m_handle));
339 return std::chrono::nanoseconds(k4a_image_get_system_timestamp_nsec(m_handle));
348 return std::chrono::microseconds(k4a_image_get_exposure_usec(m_handle));
357 return k4a_image_get_white_balance(m_handle);
366 return k4a_image_get_iso_speed(m_handle);
375 k4a_image_set_device_timestamp_usec(m_handle, internal::clamp_cast<uint64_t>(timestamp.count()));
384 k4a_image_set_exposure_usec(m_handle, internal::clamp_cast<uint64_t>(exposure.count()));
393 k4a_image_set_white_balance(m_handle, white_balance);
402 k4a_image_set_iso_speed(m_handle, iso_speed);
428 if (m_handle !=
nullptr)
430 k4a_capture_reference(m_handle);
438 other.m_handle =
nullptr;
453 m_handle = other.m_handle;
454 if (m_handle !=
nullptr)
456 k4a_capture_reference(m_handle);
469 m_handle = other.m_handle;
470 other.m_handle =
nullptr;
487 return m_handle == other.m_handle;
494 return m_handle ==
nullptr;
501 return m_handle != other.m_handle;
508 return m_handle !=
nullptr;
513 explicit operator bool() const noexcept
522 return m_handle !=
nullptr;
541 if (m_handle !=
nullptr)
543 k4a_capture_release(m_handle);
554 return image(k4a_capture_get_color_image(m_handle));
563 return image(k4a_capture_get_depth_image(m_handle));
572 return image(k4a_capture_get_ir_image(m_handle));
581 k4a_capture_set_color_image(m_handle, color_image.handle());
590 k4a_capture_set_depth_image(m_handle, depth_image.handle());
599 k4a_capture_set_ir_image(m_handle, ir_image.handle());
608 k4a_capture_set_temperature_c(m_handle, temperature_c);
617 return k4a_capture_get_temperature_c(m_handle);
631 throw error(
"Failed to create capture!");
662 throw error(
"Calibration contained invalid transformation parameters!");
664 return target_point3d;
683 this, &source_point2d, source_depth, source_camera, target_camera, target_point3d, &valid);
687 throw error(
"Calibration contained invalid transformation parameters!");
689 return static_cast<bool>(valid);
710 throw error(
"Calibration contained invalid transformation parameters!");
712 return static_cast<bool>(valid);
731 this, &source_point2d, source_depth, source_camera, target_camera, target_point2d, &valid);
735 throw error(
"Calibration contained invalid transformation parameters!");
737 return static_cast<bool>(valid);
748 const image &depth_image,
757 throw error(
"Calibration contained invalid transformation parameters!");
759 return static_cast<bool>(valid);
768 size_t raw_calibration_size,
773 k4a_result_t result = k4a_calibration_get_from_raw(raw_calibration,
774 raw_calibration_size,
776 target_color_resolution,
781 throw error(
"Failed to load calibration from raw calibration blob!");
792 size_t raw_calibration_size,
796 return get_from_raw(reinterpret_cast<char *>(raw_calibration),
797 raw_calibration_size,
799 target_color_resolution);
811 return get_from_raw(reinterpret_cast<char *>(raw_calibration.data()),
812 raw_calibration.size(),
814 target_color_resolution);
849 m_handle(other.m_handle),
850 m_color_resolution(other.m_color_resolution),
851 m_depth_resolution(other.m_depth_resolution)
853 other.m_handle =
nullptr;
870 m_handle = other.m_handle;
871 m_color_resolution = other.m_color_resolution;
872 m_depth_resolution = other.m_depth_resolution;
873 other.m_handle =
nullptr;
893 if (m_handle !=
nullptr)
895 k4a_transformation_destroy(m_handle);
908 k4a_result_t result = k4a_transformation_depth_image_to_color_camera(m_handle,
910 transformed_depth_image->
handle());
913 throw error(
"Failed to convert depth map to color camera geometry!");
926 m_color_resolution.width,
927 m_color_resolution.height,
928 m_color_resolution.width *
929 static_cast<int32_t>(
sizeof(uint16_t)));
931 return transformed_depth_image;
941 const image &custom_image,
942 image *transformed_depth_image,
943 image *transformed_custom_image,
945 uint32_t invalid_custom_value)
const 947 k4a_result_t result = k4a_transformation_depth_image_to_color_camera_custom(m_handle,
950 transformed_depth_image->
handle(),
951 transformed_custom_image->
handle(),
953 invalid_custom_value);
956 throw error(
"Failed to convert depth map and custom image to color camera geometry!");
966 std::pair<image, image>
968 const image &custom_image,
970 uint32_t invalid_custom_value)
const 973 m_color_resolution.width,
974 m_color_resolution.height,
975 m_color_resolution.width *
976 static_cast<int32_t>(
sizeof(uint16_t)));
977 int32_t bytes_per_pixel;
981 bytes_per_pixel =
static_cast<int32_t
>(
sizeof(int8_t));
984 bytes_per_pixel =
static_cast<int32_t
>(
sizeof(int16_t));
987 throw error(
"Failed to support this format of custom image!");
990 m_color_resolution.width,
991 m_color_resolution.height,
992 m_color_resolution.width * bytes_per_pixel);
995 &transformed_depth_image,
996 &transformed_custom_image,
998 invalid_custom_value);
999 return { std::move(transformed_depth_image), std::move(transformed_custom_image) };
1009 const image &color_image,
1010 image *transformed_color_image)
const 1012 k4a_result_t result = k4a_transformation_color_image_to_depth_camera(m_handle,
1015 transformed_color_image->
handle());
1018 throw error(
"Failed to convert color image to depth camera geometry!");
1031 m_depth_resolution.width,
1032 m_depth_resolution.height,
1033 m_depth_resolution.width * 4 *
1034 static_cast<int32_t>(
sizeof(uint8_t)));
1036 return transformed_color_image;
1048 k4a_transformation_depth_image_to_point_cloud(m_handle, depth_image.
handle(), camera, xyz_image->
handle());
1051 throw error(
"Failed to transform depth image to point cloud!");
1066 depth_image.
get_width_pixels() * 3 *
static_cast<int32_t
>(
sizeof(int16_t)));
1078 resolution m_color_resolution;
1079 resolution m_depth_resolution;
1101 dev.m_handle =
nullptr;
1120 m_handle = dev.m_handle;
1121 dev.m_handle =
nullptr;
1128 explicit operator bool() const noexcept
1137 return m_handle !=
nullptr;
1156 if (m_handle !=
nullptr)
1158 k4a_device_close(m_handle);
1171 int32_t timeout_ms = internal::clamp_cast<int32_t>(timeout.count());
1172 k4a_wait_result_t result = k4a_device_get_capture(m_handle, &capture_handle, timeout_ms);
1175 throw error(
"Failed to get capture from device!");
1182 *cap =
capture(capture_handle);
1203 int32_t timeout_ms = internal::clamp_cast<int32_t>(timeout.count());
1204 k4a_wait_result_t result = k4a_device_get_imu_sample(m_handle, imu_sample, timeout_ms);
1207 throw error(
"Failed to get IMU sample from device!");
1234 k4a_result_t result = k4a_device_start_cameras(m_handle, configuration);
1237 throw error(
"Failed to start cameras!");
1247 k4a_device_stop_cameras(m_handle);
1260 throw error(
"Failed to start IMU!");
1270 k4a_device_stop_imu(m_handle);
1280 std::string serialnum;
1286 serialnum.resize(buffer);
1287 result = k4a_device_get_serialnum(m_handle, &serialnum[0], &buffer);
1293 serialnum.resize(buffer - 1);
1299 throw error(
"Failed to read device serial number!");
1312 k4a_result_t result = k4a_device_get_color_control(m_handle, command, mode, value);
1315 throw error(
"Failed to read color control!");
1326 k4a_result_t result = k4a_device_set_color_control(m_handle, command, mode, value);
1329 throw error(
"Failed to set color control!");
1346 calibration.resize(buffer);
1347 result = k4a_device_get_raw_calibration(m_handle, &calibration[0], &buffer);
1352 throw error(
"Failed to read raw device calibration!");
1366 k4a_result_t result = k4a_device_get_calibration(m_handle, depth_mode, color_resolution, &calib);
1370 throw error(
"Failed to read device calibration!");
1382 bool sync_in_jack_connected, sync_out_jack_connected;
1383 k4a_result_t result = k4a_device_get_sync_jack(m_handle, &sync_in_jack_connected, &sync_out_jack_connected);
1387 throw error(
"Failed to read sync jack status!");
1389 return sync_in_jack_connected;
1399 bool sync_in_jack_connected, sync_out_jack_connected;
1400 k4a_result_t result = k4a_device_get_sync_jack(m_handle, &sync_in_jack_connected, &sync_out_jack_connected);
1404 throw error(
"Failed to read sync jack status!");
1406 return sync_out_jack_connected;
1417 k4a_result_t result = k4a_device_get_version(m_handle, &version);
1421 throw error(
"Failed to read device firmware information!");
1438 throw error(
"Failed to open device!");
1449 return k4a_device_get_installed_count();
bool is_sync_out_connected() const
Get the device jack status for the synchronization out connector Throws error on failure.
Definition: k4a.hpp:1397
Calibration type representing device calibration.
Definition: k4atypes.h:1099
The result was successful.
Definition: k4atypes.h:233
void reset() noexcept
Releases the underlying k4a_image_t; the image is set to invalid.
Definition: k4a.hpp:205
k4a_float3_t convert_3d_to_3d(const k4a_float3_t &source_point3d, k4a_calibration_type_t source_camera, k4a_calibration_type_t target_camera) const
Transform a 3d point of a source coordinate system into a 3d point of the target coordinate system...
Definition: k4a.hpp:652
capture & operator=(capture &&other) noexcept
Moves another capture into this capture; other is set to invalid.
Definition: k4a.hpp:464
void set_exposure_time(std::chrono::microseconds exposure) noexcept
Set the image's exposure time in microseconds (color images only)
Definition: k4a.hpp:382
int resolution_height
Resolution height of the calibration sensor.
Definition: k4atypes.h:1087
Color image type BGRA32.
Definition: k4atypes.h:386
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...
const uint8_t * get_buffer() const noexcept
Get the image buffer.
Definition: k4a.hpp:274
Structure to define hardware version.
Definition: k4atypes.h:1141
int get_stride_bytes() const noexcept
Get the image stride in bytes.
Definition: k4a.hpp:319
k4a_result_t
Result code returned by Azure Kinect APIs.
Definition: k4atypes.h:217
static calibration get_from_raw(char *raw_calibration, size_t raw_calibration_size, k4a_depth_mode_t target_depth_mode, k4a_color_resolution_t target_color_resolution)
Get the camera calibration for a device from a raw calibration blob.
Definition: k4a.hpp:767
Exception type thrown when a K4A API call fails.
Definition: k4a.hpp:33
void set_color_image(const image &color_image) noexcept
Set / add a color image to the capture.
Definition: k4a.hpp:579
void set_depth_image(const image &depth_image) noexcept
Set / add a depth image to the capture.
Definition: k4a.hpp:588
size_t get_size() const noexcept
Get the image buffer size in bytes.
Definition: k4a.hpp:283
k4a_depth_mode_t
Depth sensor capture modes.
Definition: k4atypes.h:290
Handle to an Azure Kinect capture.
Definition: k4atypes.h:122
bool operator==(std::nullptr_t) const noexcept
Returns false if the capture is valid, true otherwise.
Definition: k4a.hpp:492
static calibration get_from_raw(uint8_t *raw_calibration, size_t raw_calibration_size, k4a_depth_mode_t target_depth_mode, k4a_color_resolution_t target_color_resolution)
Get the camera calibration for a device from a raw calibration blob.
Definition: k4a.hpp:791
uint32_t get_white_balance() const noexcept
Get the image white balance in Kelvin (color images only)
Definition: k4a.hpp:355
k4a_buffer_result_t
Result code returned by Azure Kinect APIs.
Definition: k4atypes.h:231
static device open(uint32_t index)
Open a k4a device.
Definition: k4a.hpp:1431
capture & operator=(const capture &other) noexcept
Sets capture to a shallow copy of the other image.
Definition: k4a.hpp:448
bool get_imu_sample(k4a_imu_sample_t *imu_sample)
Reads an IMU sample.
Definition: k4a.hpp:1222
The operation timed out.
Definition: k4atypes.h:250
bool get_capture(capture *cap)
Reads a sensor capture into cap.
Definition: k4a.hpp:1191
image(k4a_image_t handle=nullptr) noexcept
Creates an image from a k4a_image_t.
Definition: k4a.hpp:88
device & operator=(device &&dev) noexcept
Moves another device into this device; other is set to invalid.
Definition: k4a.hpp:1115
std::vector< uint8_t > get_raw_calibration() const
Get the raw calibration blob for the entire K4A device.
Definition: k4a.hpp:1338
int get_width_pixels() const noexcept
Get the image width in pixels.
Definition: k4a.hpp:301
IMU sample.
Definition: k4atypes.h:1199
std::chrono::microseconds get_exposure() const noexcept
Get the image exposure time in microseconds.
Definition: k4a.hpp:346
bool is_valid() const noexcept
Returns true if the capture is valid, false otherwise.
Definition: k4a.hpp:520
void start_cameras(const k4a_device_configuration_t *configuration)
Starts the K4A device's cameras Throws error on failure.
Definition: k4a.hpp:1232
bool operator!=(const capture &other) const noexcept
Returns true if two captures wrap different k4a_capture_t instances, false otherwise.
Definition: k4a.hpp:499
bool convert_2d_to_2d(const k4a_float2_t &source_point2d, float source_depth, k4a_calibration_type_t source_camera, k4a_calibration_type_t target_camera, k4a_float2_t *target_point2d) const
Transform a 2d pixel coordinate with an associated depth value of the source camera into a 2d pixel c...
Definition: k4a.hpp:723
k4a_transformation_interpolation_type_t
Transformation interpolation type.
Definition: k4atypes.h:459
std::chrono::microseconds get_device_timestamp() const noexcept
Get the image's device timestamp in microseconds.
Definition: k4a.hpp:328
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...
calibration get_calibration(k4a_depth_mode_t depth_mode, k4a_color_resolution_t color_resolution) const
Get the camera calibration for the entire K4A device, which is used for all transformation functions...
Definition: k4a.hpp:1363
void set_iso_speed(uint32_t iso_speed) noexcept
Set the ISO speed of the image (color images only)
Definition: k4a.hpp:400
void set_ir_image(const image &ir_image) noexcept
Set / add an IR image to the capture.
Definition: k4a.hpp:597
image & operator=(const image &other) noexcept
Sets image to a shallow copy of the other image.
Definition: k4a.hpp:114
bool get_imu_sample(k4a_imu_sample_t *imu_sample, std::chrono::milliseconds timeout)
Reads an IMU sample.
Definition: k4a.hpp:1201
capture(capture &&other) noexcept
Moves another capture into a new capture.
Definition: k4a.hpp:436
std::chrono::nanoseconds get_system_timestamp() const noexcept
Get the image's system timestamp in nanoseconds.
Definition: k4a.hpp:337
bool is_sync_in_connected() const
Get the device jack status for the synchronization in connector Throws error on failure.
Definition: k4a.hpp:1380
Single channel image type CUSTOM16.
Definition: k4atypes.h:435
k4a_calibration_type_t
Calibration types.
Definition: k4atypes.h:658
image get_color_image() const noexcept
Get the color image associated with the capture.
Definition: k4a.hpp:552
static uint32_t get_installed_count() noexcept
Gets the number of connected devices.
Definition: k4a.hpp:1447
bool operator!=(std::nullptr_t) const noexcept
Returns true if the capture is valid, false otherwise.
Definition: k4a.hpp:506
void get_color_control(k4a_color_control_command_t command, k4a_color_control_mode_t *mode, int32_t *value) const
Get the K4A color sensor control value Throws error on failure.
Definition: k4a.hpp:1310
static 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)
Create an image from a pre-allocated buffer Throws error on failure.
Definition: k4a.hpp:235
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...
void set_timestamp(std::chrono::microseconds timestamp) noexcept
Set the image's timestamp in microseconds.
Definition: k4a.hpp:373
bool convert_3d_to_2d(const k4a_float3_t &source_point3d, k4a_calibration_type_t source_camera, k4a_calibration_type_t target_camera, k4a_float2_t *target_point2d) const
Transform a 3d point of a source coordinate system into a 2d pixel coordinate of the target camera...
Definition: k4a.hpp:699
Wrapper for k4a_capture_t.
Definition: k4a.hpp:414
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
bool is_valid() const noexcept
Returns true if the device is valid, false otherwise.
Definition: k4a.hpp:1135
bool operator!=(std::nullptr_t) const noexcept
Returns true if the image is valid, false otherwise.
Definition: k4a.hpp:172
capture(k4a_capture_t handle=nullptr) noexcept
Creates a capture from a k4a_capture_t Takes ownership of the handle, i.e.
Definition: k4a.hpp:422
k4a_device_t handle() const noexcept
Returns the underlying k4a_device_t handle.
Definition: k4a.hpp:1145
static capture create()
Create an empty capture object.
Definition: k4a.hpp:625
k4a_color_control_mode_t
Color sensor control mode.
Definition: k4atypes.h:622
Single channel image type CUSTOM8.
Definition: k4atypes.h:424
std::string get_serialnum() const
Get the K4A device serial number Throws error on failure.
Definition: k4a.hpp:1278
bool operator!=(const image &other) const noexcept
Returns true if two images wrap different k4a_image_t instances, false otherwise. ...
Definition: k4a.hpp:165
bool is_valid() const noexcept
Returns true if the image is valid, false otherwise.
Definition: k4a.hpp:186
capture(const capture &other) noexcept
Creates a shallow copy of another capture.
Definition: k4a.hpp:426
k4a_image_t handle() const noexcept
Returns the underlying k4a_image_t handle.
Definition: k4a.hpp:198
k4a_image_format_t get_format() const noexcept
Get the image format of the image.
Definition: k4a.hpp:292
int get_height_pixels() const noexcept
Get the image height in pixels.
Definition: k4a.hpp:310
Depth image type DEPTH16.
Definition: k4atypes.h:398
k4a_color_resolution_t
Color sensor resolutions.
Definition: k4atypes.h:309
float get_temperature_c() const noexcept
Get temperature (in Celsius) associated with the capture.
Definition: k4a.hpp:615
void() k4a_memory_destroy_cb_t(void *buffer, void *context)
Callback function for a memory object being destroyed.
Definition: k4atypes.h:868
void set_white_balance(uint32_t white_balance) noexcept
Set the white balance of the image (color images only)
Definition: k4a.hpp:391
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...
#define K4A_WAIT_INFINITE
An infinite wait time for functions that take a timeout parameter.
Definition: k4atypes.h:1240
The result was successful.
Definition: k4atypes.h:219
device(k4a_device_t handle=nullptr) noexcept
Creates a device from a k4a_device_t Takes ownership of the handle, i.e.
Definition: k4a.hpp:1095
void stop_imu() noexcept
Stops the K4A IMU.
Definition: k4a.hpp:1268
uint32_t get_iso_speed() const noexcept
Get the image's ISO speed (color images only)
Definition: k4a.hpp:364
k4a_calibration_camera_t color_camera_calibration
Color camera calibration.
Definition: k4atypes.h:1103
image & operator=(image &&other) noexcept
Moves another image into this image; other is set to invalid.
Definition: k4a.hpp:130
Wrapper for k4a_image_t.
Definition: k4a.hpp:80
void set_temperature_c(float temperature_c) noexcept
Set the temperature associated with the capture in Celsius.
Definition: k4a.hpp:606
image get_ir_image() const noexcept
Get the IR image associated with the capture.
Definition: k4a.hpp:570
bool convert_2d_to_3d(const k4a_float2_t &source_point2d, float source_depth, k4a_calibration_type_t source_camera, k4a_calibration_type_t target_camera, k4a_float3_t *target_point3d) const
Transform a 2d pixel coordinate with an associated depth value of the source camera into a 3d point o...
Definition: k4a.hpp:675
k4a_capture_t handle() const noexcept
Returns the underlying k4a_capture_t handle.
Definition: k4a.hpp:532
device(device &&dev) noexcept
Moves another device into a new device.
Definition: k4a.hpp:1099
int resolution_width
Resolution width of the calibration sensor.
Definition: k4atypes.h:1086
image & operator=(std::nullptr_t) noexcept
Invalidates this image.
Definition: k4a.hpp:143
k4a_calibration_camera_t depth_camera_calibration
Depth camera calibration.
Definition: k4atypes.h:1101
Handle to an Azure Kinect device.
Definition: k4atypes.h:66
uint8_t * get_buffer() noexcept
Get the image buffer.
Definition: k4a.hpp:265
Two dimensional floating point vector.
Definition: k4atypes.h:1160
bool operator==(std::nullptr_t) const noexcept
Returns false if the image is valid, true otherwise.
Definition: k4a.hpp:158
Handle to an Azure Kinect image.
Definition: k4atypes.h:173
image(image &&other) noexcept
Moves another image into a new image.
Definition: k4a.hpp:102
image(const image &other) noexcept
Creates a shallow copy of another image.
Definition: k4a.hpp:92
bool get_capture(capture *cap, std::chrono::milliseconds timeout)
Reads a sensor capture into cap.
Definition: k4a.hpp:1168
Wrapper for k4a_device_t.
Definition: k4a.hpp:1087
Configuration parameters for an Azure Kinect device.
Definition: k4atypes.h:917
The result was a failure.
Definition: k4atypes.h:249
void stop_cameras() noexcept
Stops the K4A device's cameras.
Definition: k4a.hpp:1245
The input buffer was too small.
Definition: k4atypes.h:235
capture & operator=(std::nullptr_t) noexcept
Invalidates this capture.
Definition: k4a.hpp:477
bool operator==(const capture &other) const noexcept
Returns true if two captures refer to the same k4a_capture_t, false otherwise.
Definition: k4a.hpp:485
void set_color_control(k4a_color_control_command_t command, k4a_color_control_mode_t mode, int32_t value)
Set the K4A color sensor control value Throws error on failure.
Definition: k4a.hpp:1324
bool operator==(const image &other) const noexcept
Returns true if two images refer to the same k4a_image_t, false otherwise.
Definition: k4a.hpp:151
k4a_color_control_command_t
Color sensor control commands.
Definition: k4atypes.h:503
Custom image format.
Definition: k4atypes.h:445
k4a_hardware_version_t get_version() const
Get the version numbers of the K4A subsystems' firmware Throws error on failure.
Definition: k4a.hpp:1414
static image create(k4a_image_format_t format, int width_pixels, int height_pixels, int stride_bytes)
Create a blank image Throws error on failure.
Definition: k4a.hpp:219
bool convert_color_2d_to_depth_2d(const k4a_float2_t &source_point2d, const image &depth_image, k4a_float2_t *target_point2d) const
Transform a 2D pixel coordinate from color camera into a 2D pixel coordinate of the depth camera...
Definition: k4a.hpp:747
Wrapper for k4a_calibration_t.
Definition: k4a.hpp:645
void start_imu()
Starts the K4A IMU Throws error on failure.
Definition: k4a.hpp:1255
k4a_wait_result_t
Result code returned by Azure Kinect APIs.
Definition: k4atypes.h:246
k4a_image_format_t
Image format type.
Definition: k4atypes.h:332
void close() noexcept
Closes a k4a device.
Definition: k4a.hpp:1154
image get_depth_image() const noexcept
Get the depth image associated with the capture.
Definition: k4a.hpp:561
static calibration get_from_raw(std::vector< uint8_t > &raw_calibration, k4a_depth_mode_t target_depth_mode, k4a_color_resolution_t target_color_resolution)
Get the camera calibration for a device from a raw calibration blob.
Definition: k4a.hpp:807
void reset() noexcept
Releases the underlying k4a_capture_t; the capture is set to invalid.
Definition: k4a.hpp:539