Class TimeSurfacePool

Inheritance Relationships

Base Type

  • public cpphots::interfaces::Clonable< TimeSurfacePool, interfaces::TimeSurfacePoolCalculator > (Template Struct Clonable)

Class Documentation

class cpphots::TimeSurfacePool : public cpphots::interfaces::Clonable<TimeSurfacePool, interfaces::TimeSurfacePoolCalculator>

Pool of time surface computations.

This class holds a pool of time surfaces so that it can dispatch events with different polarities to the appropriate time surface.

Public Functions

inline TimeSurfacePool()

Construct a new pool of time surfaces.

This constructor is provided only to create containers with TimeSurfacePool instances or to load a pool from file. It should not be used to create an usable pool.

See TimeSurfacePool::create.

~TimeSurfacePool()

Destroy the TimeSurfacePool.

TimeSurfacePool(const TimeSurfacePool &other)

Copy constructor.

Parameters

other – pool to be copied

TimeSurfacePool(TimeSurfacePool &&other)

Move constructor.

Parameters

other – pool to be copied

TimeSurfacePool &operator=(const TimeSurfacePool &other)

Copy assignment

Parameters

other – pool to be copied

TimeSurfacePool &operator=(TimeSurfacePool &&other)

Move assignment

Parameters

other – pool to be moved

inline virtual void update(uint64_t t, uint16_t x, uint16_t y, uint16_t p) override

Update the time context with a new event.

Parameters
  • t – time of the event

  • x – horizontal coordinate of the event

  • y – vertical coordinate of the event

  • p – polarity of the event

inline virtual void update(const event &ev) override

Update the time context with a new event.

Parameters

ev – the new event

inline virtual std::pair<TimeSurfaceType, bool> compute(uint64_t t, uint16_t x, uint16_t y, uint16_t p) const override

Compute the time surface for an event.

This function does not update the time context.

A time surface is considered valid if there is a certain number of relevant events, determined using an heuristic extended from the one described in the paper.

Parameters
  • t – time of the event

  • x – horizontal coordinate of the event

  • y – vertical coordinate of the event

  • p – polarity of the event

Returns

a std::pair with the computed time surface and whether the surface is valid or not

inline virtual std::pair<TimeSurfaceType, bool> compute(const event &ev) const override

Compute the time surface for an event.

This function does not update the time context.

A time surface is considered valid if there is a certain number of relevant events, determined using an heuristic extended from the on described in the paper.

Parameters

ev – the event

Returns

a std::pair with the computed time surface and whether the surface is valid or not

inline virtual std::pair<TimeSurfaceType, bool> updateAndCompute(uint64_t t, uint16_t x, uint16_t y, uint16_t p) override

Update the time context and compute the new surface.

Parameters
  • t – time of the event

  • x – horizontal coordinate of the event

  • y – vertical coordinate of the event

  • p – polarity of the event

Returns

a std::pair with the computed time surface and whether the surface is valid or not

inline virtual std::pair<TimeSurfaceType, bool> updateAndCompute(const event &ev) override

Update the time context and compute the new surface.

Parameters

ev – the event

Returns

a std::pair with the computed time surface and whether the surface is valid or not

inline virtual std::pair<uint16_t, uint16_t> getSize() const override

Returns the size of the context.

Returns

{width, height}

inline virtual void reset() override

Reset the time surfaces.

This method resets the time surfaces. It should be called before every stream of events.

inline virtual TimeSurfacePtr &getSurface(size_t idx) override

Access a time surface with boundaries check.

This method will throw an invalid_argument exception if the index of the surfaces exceeds the number of actual time surfaces.

Parameters

idx – index of the time surface

Returns

reference to the time surface

inline virtual const TimeSurfacePtr &getSurface(size_t idx) const override

Access a time surface with boundaries check.

This method will throw an invalid_argument exception if the index of the surfaces exceeds the number of actual time surfaces.

Parameters

idx – index of the time surface

Returns

reference to the time surface

inline virtual std::vector<TimeSurfaceType> sampleContexts(uint64_t t) const override

Sample and decay all temporal contexts from the pool.

This functions applies the decay to the all temporal contexts and returns them.

Parameters

t – sample time

Returns

vector of decayed temporal contexts

inline virtual size_t getNumSurfaces() const override

Get the number of surfaces in the pool.

Returns

number of surfaces

virtual void toStream(std::ostream &out) const override

Insert to stream.

Save paramaters for all time surfaces to the stream.

Parameters

out – stream where to insert to

virtual void fromStream(std::istream &in) override

Extract from stream.

Parameters/current state is expected to be overwritten or invalidated.

Load parameters for all time surfaces from the stream.

Parameters

in – stream where to extract from

Public Static Functions

template<typename TS, typename ...TSArgs>
static inline TimeSurfacePool create(uint16_t polarities, TSArgs... tsargs)

Create a time surface pool.

This function creates a pool of time surfaces, Forwarding arguments to the time surface constructors.

Template Parameters
  • TS – time surface type

  • TSArgs – types of the time surface constructor arguments

Parameters
  • polarities – numer of polarities (size of the pool)

  • tsargs – arguments forwarded to the time surface constructor

Returns

the constructed pool

template<typename TS, typename ...TSArgs>
static inline TimeSurfacePool *create_ptr(uint16_t polarities, TSArgs... tsargs)

Create pointer to a new time surface pool.

This function creates a pool of time surfaces, Forwarding arguments to the time surface constructors.

Template Parameters
  • TS – time surface type

  • TSArgs – types of the time surface constructor arguments

Parameters
  • polarities – numer of polarities (size of the pool)

  • tsargs – arguments forwarded to the time surface constructor

Returns

pointer to the constructed pool