pub struct Factory { /* private fields */ }Implementations§
Source§impl Factory
impl Factory
Sourcepub fn new() -> Result<Factory, Error>
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}pub fn with_library_directory(lib_dir: &str) -> Result<Factory, Error>
Sourcepub fn set_debug_message_handler(
self,
debug_message_handler: Box<DebugMessageHandler>,
min_level: LogLevel,
) -> Self
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.
Sourcepub fn reset_debug_message_handler(self) -> Self
pub fn reset_debug_message_handler(self) -> Self
Clears the callback function to receive debug messages from the Azure Kinect device.
Sourcepub fn device_get_installed_count(&self) -> u32
pub fn device_get_installed_count(&self) -> u32
Gets the number of connected devices
Sourcepub fn device_open(&self, index: u32) -> Result<Device<'_>, Error>
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}Sourcepub fn calibration_get_from_raw(
&self,
raw_calibration: &Vec<u8>,
target_depth_mode: DepthMode,
target_color_resolution: ColorResolution,
) -> Result<Calibration<'_>, Error>
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.
pub fn capture_create(&self) -> Result<Capture<'_>, Error>
Sourcepub fn image_create(
&self,
format: ImageFormat,
width_pixels: i32,
height_pixels: i32,
stride_bytes: i32,
) -> Result<Image<'_>, Error>
pub fn image_create( &self, format: ImageFormat, width_pixels: i32, height_pixels: i32, stride_bytes: i32, ) -> Result<Image<'_>, Error>
Create a blank image
Sourcepub 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>
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
Sourcepub 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>
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
Sourcepub fn image_create_from_buffer_with_info<T: PreAllocatedBufferInfo + Drop>(
&self,
buffer_info: Box<T>,
) -> Result<Image<'_>, Error>
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
Sourcepub fn transformation_create<'a>(
&'a self,
calibration: &'a Calibration<'_>,
) -> Transformation<'a>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more