6#ifndef OPENEV_CONTAINERS_QUEUE_HPP
7#define OPENEV_CONTAINERS_QUEUE_HPP
9#include "openev/containers/array.hpp"
10#include "openev/containers/vector.hpp"
18#ifndef OPENEV_ARRAY_HPP
19template <
typename T, std::
size_t N>
23#ifndef OPENEV_VECTOR_HPP
35class Queue_ :
public std::queue<Event_<T>> {
41 std::queue<Event_<T>>
::push(e);
49 template <std::
size_t N>
52 std::queue<Event_<T>>::emplace(std::move(e));
62 std::queue<Event_<T>>::emplace(std::move(e));
71 return std::queue<Event_<T>>::back().t - std::queue<Event_<T>>::front().t;
78 [[nodiscard]]
inline double rate()
const {
79 return std::queue<Event_<T>>::size() /
duration();
87 const std::size_t n = std::queue<Event_<T>>::size();
94 const Event_<T> &e = std::queue<Event_<T>>::front();
99 std::queue<Event_<T>>::pop();
102 return {x / n, y / n, t / n, p / n > 0.5};
110 const std::size_t n = std::queue<Event_<T>>::size();
115 const Event_<T> &e = std::queue<Event_<T>>::front();
118 std::queue<Event_<T>>::pop();
121 return {x / n, y / n};
129 const std::size_t n = std::queue<Event_<T>>::size();
133 t += std::queue<Event_<T>>::front().t;
134 std::queue<Event_<T>>::pop();
145 return 0.5 * (std::queue<Event_<T>>::front().t + std::queue<Event_<T>>::back().t);
This class extends std::array to implement event arrays. For more information, please refer here.
Definition array.hpp:21
This class extends cv::Point_<T> for event data. For more information, please refer here.
Definition types.hpp:60
bool p
Definition types.hpp:63
double t
Definition types.hpp:62
This class extends std::queue to implement event queues. For more information, please refer here.
Definition queue.hpp:35
double rate() const
Compute event rate as the ratio between the number of events and the time difference between the last...
Definition queue.hpp:78
void push(const Array_< T, N > &array)
Push elements from an array of events.
Definition queue.hpp:50
cv::Point2d meanPoint()
Compute the mean x,y point of the events.
Definition queue.hpp:109
double meanTime()
Compute the mean time of the events.
Definition queue.hpp:128
void push(const Vector_< T > &vector)
Push elements from a vector of events.
Definition queue.hpp:60
Eventd mean()
Compute the mean of the events.
Definition queue.hpp:86
double midTime() const
Calculate the midpoint time between the oldest and the newest event.
Definition queue.hpp:144
double duration() const
Time difference between the last and the first event.
Definition queue.hpp:70
This class extends std::vector to implement event vectors. For more information, please refer here.
Definition vector.hpp:36
Basic event-based vision structures based on OpenCV components.