Struct DetectionZones
pub struct DetectionZones(/* private fields */);
Expand description
Detection zone functionality.
Implementations§
§impl DetectionZones
impl DetectionZones
pub fn add_zone(
&mut self,
coordinates: Vec<(f32, f32)>,
classes: Vec<DetectionClass>,
) -> Result<ZoneID, Error>
pub fn add_zone( &mut self, coordinates: Vec<(f32, f32)>, classes: Vec<DetectionClass>, ) -> Result<ZoneID, Error>
Specify a detection zone polygon for a group of classes.
The zone can be used to verify whether a bounding-box is inside or outside
of it using the is_box_in_zone
function. It can also be used internally
by the Plumerai library to improve detection quality. A single detection
zone can be used for one or more classes.
§Arguments
coordinates
: A vector of (x, y) coordinates specifying the polygon of the detection zone in normalized coordinates, between 0 and 1. The code assumes that the first coordinate is also the final coordinate of the polygon: it should not be given by the user. The polygon must be simple (not complex): it can’t have holes or self-intersections. It is allowed to be both concave or convex.classes
: A vector of classes that the zone applies to. Must contain at least one class.
§Errors
Error::InvalidZoneClass
Error::InvalidZoneGeometry
Error::MaximumDetectionZonesReached
pub fn remove_zone(&mut self, zone_id: ZoneID) -> Result<(), Error>
pub fn remove_zone(&mut self, zone_id: ZoneID) -> Result<(), Error>
pub fn is_box_in_zone(
&self,
zone_id: &ZoneID,
prediction: &BoxPrediction,
) -> Result<bool, Error>
pub fn is_box_in_zone( &self, zone_id: &ZoneID, prediction: &BoxPrediction, ) -> Result<bool, Error>
Determines whether a box prediction is within a detection zone.
§Errors
Error::InvalidZoneID
Error::InvalidZoneClass
Error::InvalidZoneGeometry
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DetectionZones
impl RefUnwindSafe for DetectionZones
impl !Send for DetectionZones
impl !Sync for DetectionZones
impl Unpin for DetectionZones
impl UnwindSafe for DetectionZones
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