pub struct Image(pub k4a_image_t);
Expand description
Adapted from k4a-sys. Represents an image within a capture.
Tuple Fields§
§0: k4a_image_t
Implementations§
Source§impl Image
impl Image
Sourcepub fn create(
format: ImageFormat,
width: u32,
height: u32,
stride_bytes: u32,
) -> Result<Self, CreateImageError>
pub fn create( format: ImageFormat, width: u32, height: u32, stride_bytes: u32, ) -> Result<Self, CreateImageError>
Create a blank image.
This function is used to create images of formats that have consistent stride. The function is not suitable for compressed formats that may not be represented by the same number of bytes per line.
For most image formats, the function will allocate an image buffer of size height_pixels * stride_bytes. Buffers K4A_IMAGE_FORMAT_COLOR_NV12 format will allocate an additional height_pixels / 2 set of lines (each of stride_bytes). This function cannot be used to allocate K4A_IMAGE_FORMAT_COLOR_MJPG buffers.
To create an image object without the API allocating memory, or to represent an image that has a non-deterministic stride, use k4a_image_create_from_buffer().
The k4a_image_t is created with a reference count of 1.
When finished using the created image, release it with k4a_image_release.
stride_bytes - The number of bytes per horizontal line of the image. If set to 0, the stride will be set to the minimum size given the format and width_pixels.
pub fn get_height_pixels(&self) -> usize
pub fn get_width_pixels(&self) -> usize
pub fn get_stride_bytes(&self) -> usize
pub fn get_size(&self) -> usize
pub fn get_buffer(&self) -> *mut u8
Sourcepub fn get_format(&self) -> ImageFormat
pub fn get_format(&self) -> ImageFormat
Use this function to determine the format of the image buffer. This function is not expected to fail, all k4a_image_t’s are created with a known format. If the image_handle is invalid, the function will return K4A_IMAGE_FORMAT_CUSTOM.
Sourcepub fn get_handle(&self) -> k4a_image_t
pub fn get_handle(&self) -> k4a_image_t
Returns the underlying opaque handle without an additional refcount. Do not deallocate it.