Image

Struct Image 

Source
pub struct Image<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Image<'a>

Source

pub fn with_format( factory: &'a Factory, format: ImageFormat, width_pixels: i32, height_pixels: i32, stride_bytes: i32, ) -> Result<Image<'a>, Error>

👎Deprecated since 0.2: Factory::image_create

Create a blank image

Source

pub fn with_buffer( factory: &'a Factory, 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<'a>, Error>

👎Deprecated since 0.2: Factory::image_create_from_buffer

Create an image from a pre-allocated buffer

Source

pub fn get_buffer(&self) -> *const u8

Get the image buffer

Source

pub fn get_mut_buffer(&mut self) -> *mut u8

Get the mutable image buffer

Source

pub fn get_size(&self) -> usize

Get the image buffer size in bytes

Source

pub fn get_format(&self) -> ImageFormat

Get the image format of the image

Examples found in repository?
examples/open_device.rs (line 15)
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 get_width_pixels(&self) -> i32

Get the image width in pixels

Examples found in repository?
examples/open_device.rs (line 16)
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 get_height_pixels(&self) -> i32

Get the image height in pixels

Examples found in repository?
examples/open_device.rs (line 17)
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 get_stride_bytes(&self) -> i32

Get the image stride in bytes

Source

pub fn get_device_timestamp_usec(&self) -> u64

Get the image’s device timestamp in microseconds

Source

pub fn get_system_timestamp_nsec(&self) -> u64

Get the image’s system timestamp in nanoseconds

Source

pub fn get_exposure_usec(&self) -> u64

Get the image exposure time in microseconds

Source

pub fn get_white_balance(&self) -> u32

Get the image white balance in Kelvin (color images only)

Source

pub fn get_iso_speed(&self) -> u32

Get the image’s ISO speed (color images only)

Source

pub fn set_device_timestamp_usec(&mut self, timestamp: u64)

Set the image’s device timestamp in microseconds

Source

pub fn set_system_timestamp_nsec(&mut self, timestamp: u64)

Set the image’s system timestamp in nanoseconds

Source

pub fn set_exposure_usec(&mut self, exposure: u64)

Set the image exposure time in microseconds

Source

pub fn set_white_balance(&mut self, white_balance: u32)

Set the image white balance in Kelvin (color images only)

Source

pub fn set_iso_speed(&mut self, iso_speed: u32)

Set the image’s ISO speed (color images only)

Trait Implementations§

Source§

impl Clone for Image<'_>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Drop for Image<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Image<'a>

§

impl<'a> RefUnwindSafe for Image<'a>

§

impl<'a> !Send for Image<'a>

§

impl<'a> !Sync for Image<'a>

§

impl<'a> Unpin for Image<'a>

§

impl<'a> UnwindSafe for Image<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.