pub struct RoiRegion {
pub x: i32,
pub y: i32,
pub width: u32,
pub height: u32,
pub priority: f64,
pub label: String,
}Expand description
A rectangular region of interest within a frame.
Fields§
§x: i32Left edge in pixels.
y: i32Top edge in pixels.
width: u32Width in pixels.
height: u32Height in pixels.
priority: f64Priority weight (0.0 = ignore, 1.0 = normal, >1.0 = boosted).
label: StringOptional label for the region.
Implementations§
Source§impl RoiRegion
impl RoiRegion
Sourcepub fn new(x: i32, y: i32, width: u32, height: u32) -> Self
pub fn new(x: i32, y: i32, width: u32, height: u32) -> Self
Creates a new ROI region with default priority.
Sourcepub fn with_priority(
x: i32,
y: i32,
width: u32,
height: u32,
priority: f64,
) -> Self
pub fn with_priority( x: i32, y: i32, width: u32, height: u32, priority: f64, ) -> Self
Creates a new ROI region with a given priority weight.
Sourcepub fn contains(&self, px: i32, py: i32) -> bool
pub fn contains(&self, px: i32, py: i32) -> bool
Checks whether a pixel coordinate falls inside this region.
Sourcepub fn intersection_area(&self, other: &Self) -> u64
pub fn intersection_area(&self, other: &Self) -> u64
Returns the intersection area with another region, or 0 if they don’t overlap.
Trait Implementations§
impl StructuralPartialEq for RoiRegion
Auto Trait Implementations§
impl Freeze for RoiRegion
impl RefUnwindSafe for RoiRegion
impl Send for RoiRegion
impl Sync for RoiRegion
impl Unpin for RoiRegion
impl UnsafeUnpin for RoiRegion
impl UnwindSafe for RoiRegion
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more