#![doc = include_str!("../README.md")]
pub mod dcam560;
pub mod scepter;
pub mod util;
pub const DEFAULT_RESOLUTION: Resolution = Resolution::new(640, 480);
pub const DEFAULT_PIXEL_COUNT: usize = DEFAULT_RESOLUTION.to_pixel_count();
pub enum ColorFormat {
Rgb,
Bgr,
}
#[derive(PartialEq)]
pub enum ColorResolution {
Res640x480,
Res800x600,
Res1600x1200,
}
#[derive(PartialEq)]
pub struct Resolution {
width: u32,
height: u32,
}
impl Resolution {
pub const fn new(w: u32, h: u32) -> Self {
Self {
width: w,
height: h,
}
}
pub const fn to_array(&self) -> [u32; 2] {
[self.width, self.height]
}
pub const fn to_tuple(&self) -> (u32, u32) {
(self.width, self.height)
}
pub const fn to_pixel_count(&self) -> usize {
(self.width * self.height) as usize
}
pub const fn double(&self) -> Self {
Self {
width: 2 * self.width,
height: 2 * self.height,
}
}
}
pub enum DepthMeasuringRange {
Near,
Mid,
Far,
}
pub enum DataMode {
DepthAndRGB,
IRAndRGB,
DepthAndIRAndRGB,
}
#[macro_export]
#[doc(hidden)]
macro_rules! red {
($($arg:tt)*) => {format!("\x1b[31m{}\x1b[0m", format_args!($($arg)*))}
}
#[macro_export]
#[doc(hidden)]
macro_rules! yellow {
($($arg:tt)*) => {format!("\x1b[33m{}\x1b[0m", format_args!($($arg)*))}
}
#[macro_export]
#[doc(hidden)]
macro_rules! cyan {
($($arg:tt)*) => {format!("\x1b[36m{}\x1b[0m", format_args!($($arg)*))}
}