6#ifndef OPENEV_READERS_ABSTRACT_READER_HPP
7#define OPENEV_READERS_ABSTRACT_READER_HPP
15#include <opencv2/core/types.hpp>
19[[maybe_unused]]
constexpr bool USING_ABSTRACT_READER_HPP =
true;
47 if(n == 0 && queue_) {
85 void setRoi(
const cv::Rect &roi);
91 [[nodiscard]]
inline cv::Rect
getRoi()
const {
97 virtual std::size_t read_(
Event *
events,
const std::size_t max) = 0;
98 virtual void reset_() = 0;
103 std::unique_ptr<ConcurrentQueue> queue_;
105 std::atomic<bool> running_{
false};
106 std::atomic<bool> finished_{
false};
107 std::size_t level_{0};
108 TimeType timeOffset_{0};
109 TimeType timeScale_{1};
112 static constexpr std::size_t BLOCK = 512;
113 std::array<Event, BLOCK> block_;
114 std::size_t blockPos_{0};
115 std::size_t blockCount_{0};
118 void readBlock_(
const std::size_t max);
119 void resize_(
const std::size_t capacity);
This is an auxiliary class. This class cannot be instanced.
Definition abstract-reader.hpp:28
void reset()
Go back to the beginning, discarding the events in the queue.
Definition abstract-reader.cpp:59
void setRoi(const cv::Rect &roi)
Deliver only the events inside a region of interest. The events keep their coordinates.
Definition abstract-reader.cpp:82
ConcurrentQueue & events(const std::size_t n=0)
Read a given number of events, add them to the queue, and return it.
Definition abstract-reader.hpp:46
cv::Rect getRoi() const
Get the region of interest.
Definition abstract-reader.hpp:91
void setTimeTransform(const TimeType offset, const TimeType scale=1)
Transform the timestamp of every event read from now on as (t - offset) * scale.
Definition abstract-reader.cpp:73
void prefetch(const std::size_t n)
Keep the queue at a given number of events from a background thread.
Definition abstract-reader.cpp:48
std::size_t prefetchCapacity() const
Number of events prefetch() keeps in the queue.
Definition abstract-reader.hpp:63
Queue container for basic event structures, safe between a thread that pushes and a thread that pops.
ConcurrentQueuei ConcurrentQueue
Definition concurrent_queue.hpp:93
Basic event-based vision structures based on OpenCV components.
Eventi Event
Definition types.hpp:262