pub struct BoundingBox {
pub x1: f64,
pub y1: f64,
pub x2: f64,
pub y2: f64,
pub score: f64,
pub class_id: usize,
}Expand description
Floating-point bounding box for detection pipelines.
Coordinates use (x1, y1) = top-left corner and (x2, y2) = bottom-right
corner in pixel space. score is the detection confidence ∈ [0, 1]
and class_id is a zero-indexed class label.
Fields§
§x1: f64Top-left x coordinate (inclusive)
y1: f64Top-left y coordinate (inclusive)
x2: f64Bottom-right x coordinate (exclusive)
y2: f64Bottom-right y coordinate (exclusive)
score: f64Detection confidence score ∈ [0, 1]
class_id: usizeClass identifier (0-indexed)
Implementations§
Source§impl BoundingBox
impl BoundingBox
Sourcepub fn new(
x1: f64,
y1: f64,
x2: f64,
y2: f64,
score: f64,
class_id: usize,
) -> Self
pub fn new( x1: f64, y1: f64, x2: f64, y2: f64, score: f64, class_id: usize, ) -> Self
Create a new BoundingBox, normalising corners so x1 ≤ x2 and y1 ≤ y2.
§Arguments
x1,y1– top-left pixel coordinatex2,y2– bottom-right pixel coordinatescore– confidence scoreclass_id– class index
Sourcepub fn from_center(
cx: f64,
cy: f64,
w: f64,
h: f64,
score: f64,
class_id: usize,
) -> Self
pub fn from_center( cx: f64, cy: f64, w: f64, h: f64, score: f64, class_id: usize, ) -> Self
Create a box from centre coordinates and width/height.
Trait Implementations§
Source§impl Clone for BoundingBox
impl Clone for BoundingBox
Source§fn clone(&self) -> BoundingBox
fn clone(&self) -> BoundingBox
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BoundingBox
impl Debug for BoundingBox
Source§impl PartialEq for BoundingBox
impl PartialEq for BoundingBox
impl StructuralPartialEq for BoundingBox
Auto Trait Implementations§
impl Freeze for BoundingBox
impl RefUnwindSafe for BoundingBox
impl Send for BoundingBox
impl Sync for BoundingBox
impl Unpin for BoundingBox
impl UnsafeUnpin for BoundingBox
impl UnwindSafe for BoundingBox
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,
impl<T> Scalar for T
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.