[][src]Struct kinect::Image

pub struct Image(pub k4a_image_t);

Adapted from k4a-sys. Represents an image within a capture.

Implementations

impl Image[src]

pub fn create(
    format: ImageFormat,
    width: u32,
    height: u32,
    stride_bytes: u32
) -> Result<Self, CreateImageError>
[src]

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[src]

pub fn get_width_pixels(&self) -> usize[src]

pub fn get_stride_bytes(&self) -> usize[src]

pub fn get_size(&self) -> usize[src]

pub fn get_buffer(&self) -> *mut u8[src]

pub fn get_format(&self) -> ImageFormat[src]

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.

pub fn get_handle(&self) -> k4a_image_t[src]

Returns the underlying opaque handle without an additional refcount. Do not deallocate it.

Trait Implementations

impl Clone for Image[src]

Handles are refcounted by libk4a. The final reference is destroyed

impl Debug for Image[src]

impl Drop for Image[src]

Remove a libk4a image refcount on every drop. When the refcount drops to zero, the image goes away.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.