OpenEV
Extending OpenCV to event-based vision
Loading...
Searching...
No Matches
ev::SlidingWindow_< T > Class Template Reference

FIFO event container that retains only events within a trailing time window. More...

#include <sliding_window.hpp>

Inheritance diagram for ev::SlidingWindow_< T >:
ev::Deque_< T > ev::Stats_< Deque_< T > >

Public Member Functions

 SlidingWindow_ (const TimeType window=0)
 Construct a sliding window with the given temporal span.
TimeType window () const
 Return the current time window length.
void setWindow (const TimeType window)
 Set a new time window length and immediately discard events outside the new window.
void push (const Event_< T > &event)
 Push an event to the back and discard front events older than the window.
void push (Event_< T > &&event)
 Push an event (move) to the back and discard front events older than the window.
template<typename... Args>
void emplace (Args &&...args)
 Construct an event in-place at the back and discard front events older than the window.
Public Member Functions inherited from ev::Stats_< Deque_< T > >
ResultType duration () const
 Time difference between the last and the first event.
ResultType rate () const
 Compute event rate as the ratio between the number of events and the time difference between the last and the first event.
ResultType density (const cv::Size size) const
 Compute event density as the ratio between the number of events and the number of pixels.
std::size_t activePixels () const
 Count the pixels with at least one event.
ResultType fillRatio (const cv::Size size) const
 Compute fill ratio as the fraction of pixels with at least one event.
ResultType polarityRatio (const PolarityType p) const
 Compute polarity ratio as the fraction of events with the given polarity.
Event_< ResultType > mean () const
 Compute the mean of the events.
cv::Point_< ResultType > meanPoint () const
 Compute the mean x,y point of the events.
cv::Matx< ResultType, 2, 2 > covariance () const
 Compute the covariance of the x,y coordinates of the events around meanPoint().
cv::Rect boundingBox () const
 Compute the smallest rectangle of pixels containing the events.
ResultType meanTime () const
 Compute the mean time of the events.
ResultType midTime () const
 Calculate the midpoint time between the oldest and the newest event.
std::size_t peak () const
 Find the largest number of events on a single pixel.
ResultType entropy () const
 Compute the Shannon entropy of the spatial distribution of the events.

Additional Inherited Members

Public Types inherited from ev::Stats_< Deque_< T > >
using ResultType

Detailed Description

template<typename T>
class ev::SlidingWindow_< T >

FIFO event container that retains only events within a trailing time window.

Events are pushed to the back; after each insertion, front events older than \( t_{newest} - window \) are automatically discarded. Inherits all Deque_ statistics (duration, rate, mean, etc.) computed over the retained events.

Analogously to OpenCV library, the following aliases are defined for convenience:

SlidingWindow_(const TimeType window=0)
Construct a sliding window with the given temporal span.
Definition sliding_window.hpp:40
SlidingWindowi SlidingWindow
Definition sliding_window.hpp:104
SlidingWindow_< float > SlidingWindowf
Definition sliding_window.hpp:102
SlidingWindow_< long > SlidingWindowl
Definition sliding_window.hpp:101
SlidingWindow_< double > SlidingWindowd
Definition sliding_window.hpp:103
SlidingWindow_< int > SlidingWindowi
Definition sliding_window.hpp:100

Constructor & Destructor Documentation

◆ SlidingWindow_()

template<typename T>
ev::SlidingWindow_< T >::SlidingWindow_ ( const TimeType window = 0)
inlineexplicit

Construct a sliding window with the given temporal span.

Parameters
windowTime window length in the same units as Event_::t (default 0, retains all events).

Member Function Documentation

◆ push() [1/2]

template<typename T>
void ev::SlidingWindow_< T >::push ( const Event_< T > & event)
inline

Push an event to the back and discard front events older than the window.

Parameters
eventEvent to add

◆ push() [2/2]

template<typename T>
void ev::SlidingWindow_< T >::push ( Event_< T > && event)
inline

Push an event (move) to the back and discard front events older than the window.

Parameters
eventEvent to add

◆ setWindow()

template<typename T>
void ev::SlidingWindow_< T >::setWindow ( const TimeType window)
inline

Set a new time window length and immediately discard events outside the new window.

Parameters
windowNew window length

◆ window()

template<typename T>
TimeType ev::SlidingWindow_< T >::window ( ) const
inlinenodiscard

Return the current time window length.

Returns
Window length

The documentation for this class was generated from the following file: