OpenEV
Extending OpenCV to event-based vision
Loading...
Searching...
No Matches
ev::AbstractReader_ Class Reference

This is an auxiliary class. This class cannot be instanced. More...

#include <abstract-reader.hpp>

Inheritance diagram for ev::AbstractReader_:
ev::HDF5Reader ev::PlainTextReader RecordedReader

Public Member Functions

ConcurrentQueue & events (const std::size_t n=0)
 Read a given number of events, add them to the queue, and return it.
void prefetch (const std::size_t n)
 Keep the queue at a given number of events from a background thread.
std::size_t prefetchCapacity () const
 Number of events prefetch() keeps in the queue.
void reset ()
 Go back to the beginning, discarding the events in the queue.
void setTimeTransform (const TimeType offset, const TimeType scale=1)
 Transform the timestamp of every event read from now on as (t - offset) * scale.
void setRoi (const cv::Rect &roi)
 Deliver only the events inside a region of interest. The events keep their coordinates.
cv::Rect getRoi () const
 Get the region of interest.

Detailed Description

This is an auxiliary class. This class cannot be instanced.

A reader delivers its events through a queue: events(n) reads n events and adds them to the queue. With prefetch(), a background thread keeps the queue at a given number of events.

Note
The queue is safe between the thread of prefetch() and one thread using the reader.

Member Function Documentation

◆ events()

ConcurrentQueue & ev::AbstractReader_::events ( const std::size_t n = 0)
inlinenodiscard

Read a given number of events, add them to the queue, and return it.

Parameters
nNumber of events to add to the queue; none by default, which just returns the queue
Returns
Reference to the queue.
Note
With prefetch(), the thread is who adds events, so this waits until the queue holds n events.
With prefetch(), asking for more events than it keeps produces an exception.

◆ getRoi()

cv::Rect ev::AbstractReader_::getRoi ( ) const
inlinenodiscard

Get the region of interest.

Returns
Region of interest in pixels, empty if every event is delivered

◆ prefetch()

void ev::AbstractReader_::prefetch ( const std::size_t n)

Keep the queue at a given number of events from a background thread.

Parameters
nNumber of events to keep in the queue; zero stops the thread

◆ prefetchCapacity()

std::size_t ev::AbstractReader_::prefetchCapacity ( ) const
inlinenodiscard

Number of events prefetch() keeps in the queue.

Returns
Number of events, zero if there is no thread

◆ setRoi()

void ev::AbstractReader_::setRoi ( const cv::Rect & roi)

Deliver only the events inside a region of interest. The events keep their coordinates.

Parameters
roiRegion of interest in pixels; an empty region delivers every event
Note
Meant to be set before reading. Events already read are not affected.

◆ setTimeTransform()

void ev::AbstractReader_::setTimeTransform ( const TimeType offset,
const TimeType scale = 1 )

Transform the timestamp of every event read from now on as (t - offset) * scale.

Parameters
offsetTime subtracted from the timestamps, in the units of the file
scaleFactor applied afterwards, for instance 1e6 to deliver microseconds from a file in seconds
Note
Meant to be set before reading.

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