OpenEV
Extending OpenCV to event-based vision
 
Loading...
Searching...
No Matches
circular.hpp
Go to the documentation of this file.
1
6#ifndef OPENEV_CONTAINERS_CIRCULAR_HPP
7#define OPENEV_CONTAINERS_CIRCULAR_HPP
8
10#include <boost/circular_buffer.hpp>
11#include <opencv2/core/types.hpp>
12#include <utility>
13
14namespace ev {
20template <typename T>
21class CircularBuffer_ : public boost::circular_buffer<Event_<T>> {
22 using boost::circular_buffer<Event_<T>>::circular_buffer;
23
24public:
26 template <typename... Args>
27 inline void emplace_back(Args &&...args) {
28 boost::circular_buffer<Event_<T>>::push_back(Event_<T>(std::forward<Args>(args)...));
29 }
30
31 template <typename... Args>
32 inline void emplace_front(Args &&...args) {
33 boost::circular_buffer<Event_<T>>::push_front(Event_<T>(std::forward<Args>(args)...));
34 }
36
41 [[nodiscard]] inline double duration() const;
42
47 [[nodiscard]] inline double rate() const;
48
53 [[nodiscard]] Eventd mean() const;
54
59 [[nodiscard]] inline cv::Point2d meanPoint() const;
60
65 [[nodiscard]] inline double meanTime() const;
66
71 [[nodiscard]] inline double midTime() const;
72};
78} // namespace ev
79
80#endif // OPENEV_CONTAINERS_CIRCULAR_HPP
CircularBufferi CircularBuffer
Definition circular.hpp:77
CircularBuffer_< float > CircularBufferf
Definition circular.hpp:75
CircularBuffer_< long > CircularBufferl
Definition circular.hpp:74
CircularBuffer_< int > CircularBufferi
Definition circular.hpp:73
CircularBuffer_< double > CircularBufferd
Definition circular.hpp:76
This class extends boost::circular_buffer to implement event circular buffers. For more information,...
Definition circular.hpp:21
double rate() const
Compute event rate as the ratio between the number of events and the time difference between the last...
Definition circular.cpp:16
double midTime() const
Calculate the midpoint time between the oldest and the newest event.
Definition circular.cpp:42
double duration() const
Time difference between the last and the first event.
Definition circular.cpp:11
cv::Point2d meanPoint() const
Compute the mean x,y point of the events.
Definition circular.cpp:30
Eventd mean() const
Compute the mean of the events.
Definition circular.cpp:21
double meanTime() const
Compute the mean time of the events.
Definition circular.cpp:37
This class extends cv::Point_<T> for event data. For more information, please refer here.
Definition types.hpp:55
Basic event-based vision structures based on OpenCV components.
Event_< double > Eventd
Definition types.hpp:207