Factory

Struct Factory 

Source
pub struct Factory { /* private fields */ }

Implementations§

Source§

impl Factory

Source

pub fn new() -> Result<Factory, Error>

Examples found in repository?
examples/open_device.rs (line 4)
3pub fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
4    let factory = Factory::new()?;
5    let device = factory.device_open(0)?;
6    let camera_config = DeviceConfiguration::builder()
7        .depth_mode(DepthMode::WFov2x2Binned)
8        .build();
9    let camera = device.start_cameras(&camera_config)?;
10
11    if let Ok(capture) = camera.get_capture(1000) {
12        let image = capture.get_color_image();
13        println!(
14            "format = {:?}, width = {}, height = {}, temparature = {}",
15            image.get_format(),
16            image.get_width_pixels(),
17            image.get_height_pixels(),
18            capture.get_temperature_c()
19        );
20    }
21
22    Ok(())
23}
Source

pub fn with_library_directory(lib_dir: &str) -> Result<Factory, Error>

Source

pub fn set_debug_message_handler( self, debug_message_handler: Box<DebugMessageHandler>, min_level: LogLevel, ) -> Self

Sets and clears the callback function to receive debug messages from the Azure Kinect device.

Source

pub fn reset_debug_message_handler(self) -> Self

Clears the callback function to receive debug messages from the Azure Kinect device.

Source

pub fn device_get_installed_count(&self) -> u32

Gets the number of connected devices

Source

pub fn device_open(&self, index: u32) -> Result<Device<'_>, Error>

Open a k4a device.

Examples found in repository?
examples/open_device.rs (line 5)
3pub fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
4    let factory = Factory::new()?;
5    let device = factory.device_open(0)?;
6    let camera_config = DeviceConfiguration::builder()
7        .depth_mode(DepthMode::WFov2x2Binned)
8        .build();
9    let camera = device.start_cameras(&camera_config)?;
10
11    if let Ok(capture) = camera.get_capture(1000) {
12        let image = capture.get_color_image();
13        println!(
14            "format = {:?}, width = {}, height = {}, temparature = {}",
15            image.get_format(),
16            image.get_width_pixels(),
17            image.get_height_pixels(),
18            capture.get_temperature_c()
19        );
20    }
21
22    Ok(())
23}
Source

pub fn calibration_get_from_raw( &self, raw_calibration: &Vec<u8>, target_depth_mode: DepthMode, target_color_resolution: ColorResolution, ) -> Result<Calibration<'_>, Error>

Get the camera calibration for a device from a raw calibration blob.

Source

pub fn capture_create(&self) -> Result<Capture<'_>, Error>

Source

pub fn image_create( &self, format: ImageFormat, width_pixels: i32, height_pixels: i32, stride_bytes: i32, ) -> Result<Image<'_>, Error>

Create a blank image

Source

pub fn image_create_from_buffer_native( &self, format: ImageFormat, width_pixels: i32, height_pixels: i32, stride_bytes: i32, buffer: *mut u8, buffer_size: usize, buffer_release_cb: Option<MemoryDestroyCallback>, buffer_release_cb_context: *mut (), ) -> Result<Image<'_>, Error>

Create an image from a pre-allocated buffer

Source

pub fn image_create_from_buffer<T: FnOnce(*mut ())>( &self, format: ImageFormat, width_pixels: i32, height_pixels: i32, stride_bytes: i32, buffer: *mut u8, buffer_size: usize, buffer_release_cb: Box<T>, ) -> Result<Image<'_>, Error>

Create an image from a pre-allocated buffer

Source

pub fn image_create_from_buffer_with_info<T: PreAllocatedBufferInfo + Drop>( &self, buffer_info: Box<T>, ) -> Result<Image<'_>, Error>

Create an image from a pre-allocated buffer

Source

pub fn transformation_create<'a>( &'a self, calibration: &'a Calibration<'_>, ) -> Transformation<'a>

Get handle to transformation handle.

Auto Trait Implementations§

§

impl Freeze for Factory

§

impl !RefUnwindSafe for Factory

§

impl !Send for Factory

§

impl !Sync for Factory

§

impl Unpin for Factory

§

impl !UnwindSafe for Factory

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.