pub struct DepthMap {
pub data: Array2<f64>,
pub scale: f64,
pub min_depth: f64,
pub max_depth: f64,
}Expand description
A depth map with associated metadata.
Stores per-pixel depth values together with calibration metadata that allows converting raw network outputs (which are typically scale-ambiguous) into metric depths.
Fields§
§data: Array2<f64>Per-pixel depth values. Shape is [H, W].
scale: f64Multiplicative scale factor that maps data values to metric depth
(metres). For ground-truth or metric depths set to 1.0.
min_depth: f64Smallest valid (positive) depth in the map.
max_depth: f64Largest valid depth in the map.
Implementations§
Source§impl DepthMap
impl DepthMap
Sourcepub fn new(
data: Array2<f64>,
scale: f64,
min_depth: f64,
max_depth: f64,
) -> Self
pub fn new( data: Array2<f64>, scale: f64, min_depth: f64, max_depth: f64, ) -> Self
Create a new DepthMap with explicit metadata.
Sourcepub fn from_data(data: Array2<f64>, scale: f64) -> Self
pub fn from_data(data: Array2<f64>, scale: f64) -> Self
Create a DepthMap by computing metadata automatically from the data.
All positive finite values are considered valid depth samples.
If no valid values exist, min_depth and max_depth are set to 0.0.
§Example
use scirs2_vision::depth_estimation::DepthMap;
use scirs2_core::ndarray::Array2;
let data = Array2::from_shape_vec((2, 2), vec![1.0, 2.0, 3.0, 4.0]).unwrap();
let dm = DepthMap::from_data(data, 1.0);
assert!((dm.min_depth - 1.0).abs() < 1e-9);
assert!((dm.max_depth - 4.0).abs() < 1e-9);Trait Implementations§
Auto Trait Implementations§
impl Freeze for DepthMap
impl RefUnwindSafe for DepthMap
impl Send for DepthMap
impl Sync for DepthMap
impl Unpin for DepthMap
impl UnsafeUnpin for DepthMap
impl UnwindSafe for DepthMap
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.