Struct Device

Source
pub struct Device { /* private fields */ }
Expand description

The main interface to the camera.

Implementations§

Source§

impl Device

Source

pub fn initialize(scan_time: Duration, verbose: bool) -> Result<Self, String>

Initializes the sytem and returns a device if it finds one. Make sure a Vzense camera is connected. scan_time should be at least one second to find a device. Set scan_time = Duration::MAX to scan until a device was found (useful to wait for reconnection after the connection to a device was interrupted).

Source

pub fn set_depth_range(&mut self, min_depth_mm: u16, max_depth_mm: u16)

Choosing the min/max depth in mm for the color mapping of the depth output. These values also bound the depths used in the util::TochDetector to reduce measuring artifacts.

Source

pub fn get_frame_rate(&self) -> Result<u8, String>

Get the current frame rate of the camera.

Source

pub fn set_frame_rate(&self, rate: u8) -> Result<(), String>

Set the ToF frame rate. Different devices have different maximum values. Please refer to the device specification.

Source

pub fn get_frame_info(&self) -> String

Get frame info like frame type, pixel format, width, height, etc.

Source

pub fn check_pixel_count(&self, pixel_count: usize)

Checks if the number of pixels in frame equals pixel_count.

Source

pub fn set_color_format(&self, format: ColorFormat)

Set the color frame format to either RGB or BGR.

Source

pub fn map_color_to_depth(&mut self, is_enabled: bool)

Enable or disable the mapping of the color image to depth camera space.

Source

pub fn set_color_resolution( &mut self, resolution: ColorResolution, ) -> Resolution

Sets the resolution of the color frame. Three resolutions are currently available: 640x480, 800x600, and 1600x1200.

Source

pub fn get_color_resolution(&self) -> Resolution

Returns the resolution of the color frame.

Source

pub fn set_depth_measuring_range(&self, depth_range: DepthMeasuringRange)

Sets the depth range mode.

Source

pub fn get_depth_measuring_range(&self) -> (u16, u16)

Returns the current depth measuring range (min, max) of the camera in mm.

Source

pub fn set_wait_time(&self, time: u16)

Set the wait time for the call to read_next_frame in ms.

Source

pub fn get_data_mode(&self) -> Result<u32, String>

Current data mode.

Source

pub fn shut_down(&mut self, verbose: bool)

Stops the stream, closes the device, and clears all resources.

Source

pub fn get_device_info(&self, device_count: u32) -> Result<[String; 4], String>

Returns device info as an array of Strings: [model, IP, firmware, serial number]

Source

pub fn init() -> Result<Self, String>

👎Deprecated since 0.3.0: Use initialize(scan_time, verbose) instead.

Trait Implementations§

Source§

impl Data for Device

Data trait to allow use of Device in util::TouchDetector.

Auto Trait Implementations§

§

impl Freeze for Device

§

impl RefUnwindSafe for Device

§

impl !Send for Device

§

impl !Sync for Device

§

impl Unpin for Device

§

impl UnwindSafe for Device

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.