Azure Kinect Sensor SDK  refs/heads/master
Documentation for https://github.com/Microsoft/Azure-Kinect-Sensor-SDK

◆ k4a_image_create_from_buffer()

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 
)
related

Create an image from a pre-allocated buffer.

Parameters
formatThe format of the image that will be stored in this image container.
width_pixelsWidth in pixels.
height_pixelsHeight in pixels.
stride_bytesThe number of bytes per horizontal line of the image.
bufferPointer to a pre-allocated image buffer.
buffer_sizeSize in bytes of the pre-allocated image buffer.
buffer_release_cbCallback to the buffer free function, called when all references to the buffer have been released. This parameter is optional.
buffer_release_cb_contextContext for the buffer free function. This value will be called as a parameter to buffer_release_cb when the callback is invoked.
image_handlePointer to store image handle in.
Remarks
This function creates a k4a_image_t from a pre-allocated buffer. When all references to this object reach zero the provided buffer_release_cb callback function is called so that the memory can be released. If this function fails, the API will not use the memory provided in buffer, and the API will not call buffer_release_cb.
The k4a_image_t is created with a reference count of 1.
Release the reference on this function with k4a_image_release().
Returns
Returns K4A_RESULT_SUCCEEDED on success. Errors are indicated with K4A_RESULT_FAILED and error specific data can be found in the log.