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

This class arranges any event container into a grid of MxN cells covering the sensor. More...

#include <grid.hpp>

Public Types

using EventType = typename Container::value_type
using T = typename EventType::value_type

Public Member Functions

template<typename... Args>
 Grid_ (const cv::Size sensor, const cv::Size cells, Args &&...args)
 Construct a grid of cells covering the sensor.
bool insert (const EventType &e)
 Insert an event into the cell its coordinates fall into.
cv::Point cell (const EventType &e) const
 Cell an event falls into.
Container & operator() (const int row, const int col)
 Access a cell.
const Container & operator() (const int row, const int col) const
 Access a cell.
Container & operator() (const cv::Point c)
 Access a cell.
const Container & operator() (const cv::Point c) const
 Access a cell.
void clear ()
 Reset every cell to its freshly constructed state.
int rows () const
 Number of rows of the grid.
int cols () const
 Number of columns of the grid.
cv::Size size () const
 Number of cells: width columns and height rows.
cv::Size cellSize () const
 Size of each cell in pixels.
cv::Size sensorSize () const
 Size of the sensor in pixels.

Detailed Description

template<typename Container>
class ev::Grid_< Container >

This class arranges any event container into a grid of MxN cells covering the sensor.

Any container that offers push() or push_back() can be used as cell; push() takes precedence, so containers such as ev::SlidingWindow_ keep their own insertion policy:

ev::Grid_<ev::Vector> grid(cv::Size(640, 480), cv::Size(4, 3));
ev::Grid_<ev::CircularBuffer> grid(cv::Size(640, 480), cv::Size(4, 3), 100);
ev::Grid_<ev::SlidingWindow> grid(cv::Size(640, 480), cv::Size(4, 3), 0.1);
This class arranges any event container into a grid of MxN cells covering the sensor.
Definition grid.hpp:44

Member Typedef Documentation

◆ EventType

template<typename Container>
using ev::Grid_< Container >::EventType = typename Container::value_type

Event type held by the cells

◆ T

template<typename Container>
using ev::Grid_< Container >::T = typename EventType::value_type

Coordinate type of the events

Constructor & Destructor Documentation

◆ Grid_()

template<typename Container>
template<typename... Args>
ev::Grid_< Container >::Grid_ ( const cv::Size sensor,
const cv::Size cells,
Args &&... args )
inlineexplicit

Construct a grid of cells covering the sensor.

Parameters
sensorSensor size in pixels
cellsNumber of cells: width columns and height rows
argsArguments forwarded to the constructor of every cell

Member Function Documentation

◆ cell()

template<typename Container>
cv::Point ev::Grid_< Container >::cell ( const EventType & e) const
inlinenodiscard

Cell an event falls into.

Parameters
eEvent
Returns
Cell as (column, row), or (-1, -1) if the event is outside the sensor

◆ cellSize()

template<typename Container>
cv::Size ev::Grid_< Container >::cellSize ( ) const
inlinenodiscard

Size of each cell in pixels.

Returns
Cell size

◆ cols()

template<typename Container>
int ev::Grid_< Container >::cols ( ) const
inlinenodiscard

Number of columns of the grid.

Returns
Columns

◆ insert()

template<typename Container>
bool ev::Grid_< Container >::insert ( const EventType & e)
inline

Insert an event into the cell its coordinates fall into.

Parameters
eEvent to insert
Returns
True if the event is inside the sensor and was inserted

◆ operator()() [1/4]

template<typename Container>
Container & ev::Grid_< Container >::operator() ( const cv::Point c)
inlinenodiscard

Access a cell.

Parameters
cCell as (column, row)
Returns
Reference to the cell container

◆ operator()() [2/4]

template<typename Container>
const Container & ev::Grid_< Container >::operator() ( const cv::Point c) const
inlinenodiscard

Access a cell.

Parameters
cCell as (column, row)
Returns
Const reference to the cell container

◆ operator()() [3/4]

template<typename Container>
Container & ev::Grid_< Container >::operator() ( const int row,
const int col )
inlinenodiscard

Access a cell.

Parameters
rowRow index
colColumn index
Returns
Reference to the cell container

◆ operator()() [4/4]

template<typename Container>
const Container & ev::Grid_< Container >::operator() ( const int row,
const int col ) const
inlinenodiscard

Access a cell.

Parameters
rowRow index
colColumn index
Returns
Const reference to the cell container

◆ rows()

template<typename Container>
int ev::Grid_< Container >::rows ( ) const
inlinenodiscard

Number of rows of the grid.

Returns
Rows

◆ sensorSize()

template<typename Container>
cv::Size ev::Grid_< Container >::sensorSize ( ) const
inlinenodiscard

Size of the sensor in pixels.

Returns
Sensor size

◆ size()

template<typename Container>
cv::Size ev::Grid_< Container >::size ( ) const
inlinenodiscard

Number of cells: width columns and height rows.

Returns
Grid shape

The documentation for this class was generated from the following file:
  • modules/containers/include/openev/containers/grid.hpp