[−][src]Struct kinect::Image
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]
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
[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
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
[src]
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
impl RefUnwindSafe for Image
[src]
impl !Send for Image
[src]
impl !Sync for Image
[src]
impl Unpin for Image
[src]
impl UnwindSafe for Image
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,