Struct DetectionZones

pub struct DetectionZones(/* private fields */);
Expand description

Detection zone functionality.

Implementations§

§

impl DetectionZones

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>

Remove an existing detection zone.

§Errors
  • Error::InvalidZoneID

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§

§

impl Debug for DetectionZones

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.