pub struct Device { /* private fields */ }
Expand description
The main interface to the camera.
Implementations§
Source§impl Device
impl Device
Sourcepub fn initialize(scan_time: Duration, verbose: bool) -> Result<Self, String>
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).
Sourcepub fn set_depth_range(&mut self, min_depth_mm: u16, max_depth_mm: u16)
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.
Sourcepub fn get_frame_rate(&self) -> Result<u8, String>
pub fn get_frame_rate(&self) -> Result<u8, String>
Get the current frame rate of the camera.
Sourcepub fn set_frame_rate(&self, rate: u8) -> Result<(), String>
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.
Sourcepub fn get_frame_info(&self) -> String
pub fn get_frame_info(&self) -> String
Get frame info like frame type, pixel format, width, height, etc.
Sourcepub fn check_pixel_count(&self, pixel_count: usize)
pub fn check_pixel_count(&self, pixel_count: usize)
Checks if the number of pixels in frame
equals pixel_count
.
Sourcepub fn set_color_format(&self, format: ColorFormat)
pub fn set_color_format(&self, format: ColorFormat)
Set the color frame format to either RGB or BGR.
Sourcepub fn map_color_to_depth(&mut self, is_enabled: bool)
pub fn map_color_to_depth(&mut self, is_enabled: bool)
Enable or disable the mapping of the color image to depth camera space.
Sourcepub fn set_color_resolution(
&mut self,
resolution: ColorResolution,
) -> Resolution
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.
Sourcepub fn get_color_resolution(&self) -> Resolution
pub fn get_color_resolution(&self) -> Resolution
Returns the resolution of the color frame.
Sourcepub fn set_depth_measuring_range(&self, depth_range: DepthMeasuringRange)
pub fn set_depth_measuring_range(&self, depth_range: DepthMeasuringRange)
Sets the depth range mode.
Sourcepub fn get_depth_measuring_range(&self) -> (u16, u16)
pub fn get_depth_measuring_range(&self) -> (u16, u16)
Returns the current depth measuring range (min, max)
of the camera in mm.
Sourcepub fn set_wait_time(&self, time: u16)
pub fn set_wait_time(&self, time: u16)
Set the wait time for the call to read_next_frame
in ms.
Sourcepub fn get_data_mode(&self) -> Result<u32, String>
pub fn get_data_mode(&self) -> Result<u32, String>
Current data mode.
Sourcepub fn shut_down(&mut self, verbose: bool)
pub fn shut_down(&mut self, verbose: bool)
Stops the stream, closes the device, and clears all resources.
Sourcepub fn get_device_info(&self, device_count: u32) -> Result<[String; 4], String>
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]
pub fn init() -> Result<Self, String>
Trait Implementations§
Source§impl Data for Device
Data
trait to allow use of Device
in util::TouchDetector
.
impl Data for Device
Data
trait to allow use of Device
in util::TouchDetector
.