Skip to main content

ZoneAnalytics

Struct ZoneAnalytics 

Source
pub struct ZoneAnalytics<'a, const N: usize> { /* private fields */ }
Expand description

Polygon zone analytics with hysteresis, dwell, and occupancy.

Implementations§

Source§

impl<'a, const N: usize> ZoneAnalytics<'a, N>

Source

pub fn new( zone_id: ZoneId, polygon: Polygon<'a>, config: ZoneAnalyticsConfig, ) -> Result<Self, AnalyticsError>

Creates analytics for polygon with a validated configuration.

§Errors

Returns config validation errors.

Source

pub const fn occupancy(&self) -> u32

Current confirmed occupancy.

Source

pub fn update( &mut self, track_id: TrackId, bbox: Rect, class_id: Option<ClassId>, mask_centroid: Option<Point>, frame_index: u64, now: MediaTime, output: &mut [AnalyticsEvent], ) -> Result<usize, AnalyticsError>

Updates one track sample and writes zero or more events to output.

§Errors

Returns AnalyticsError::InsufficientCapacity when no track slot or event capacity remains. On error, monitor state is unchanged for the capacity path when possible; partial event writes do not occur.

Source

pub fn note_miss( &mut self, track_id: TrackId, now: MediaTime, output: &mut [AnalyticsEvent], ) -> Result<usize, AnalyticsError>

Notes a missed frame for a track; may trigger exit after tolerance.

§Errors

Returns capacity errors when emitting exit events.

Source

pub fn visit_count(&self, track_id: TrackId) -> Option<u32>

Visit count for a track, if known.

Source

pub fn time_in_zone_ns(&self, track_id: TrackId, now: MediaTime) -> Option<i64>

Time currently spent inside for an active dwell, in nanoseconds.

Auto Trait Implementations§

§

impl<'a, const N: usize> Freeze for ZoneAnalytics<'a, N>
where [Option<TrackAnalytics>; N]: Freeze,

§

impl<'a, const N: usize> RefUnwindSafe for ZoneAnalytics<'a, N>
where [Option<TrackAnalytics>; N]: RefUnwindSafe,

§

impl<'a, const N: usize> Send for ZoneAnalytics<'a, N>
where [Option<TrackAnalytics>; N]: Send,

§

impl<'a, const N: usize> Sync for ZoneAnalytics<'a, N>
where [Option<TrackAnalytics>; N]: Sync,

§

impl<'a, const N: usize> Unpin for ZoneAnalytics<'a, N>
where [Option<TrackAnalytics>; N]: Unpin,

§

impl<'a, const N: usize> UnsafeUnpin for ZoneAnalytics<'a, N>
where [Option<TrackAnalytics>; N]: UnsafeUnpin,

§

impl<'a, const N: usize> UnwindSafe for ZoneAnalytics<'a, N>
where [Option<TrackAnalytics>; N]: UnwindSafe,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.