Class TimeSurfacePoolCalculator

Inheritance Relationships

Base Types

Derived Types

Class Documentation

class cpphots::interfaces::TimeSurfacePoolCalculator : public virtual cpphots::interfaces::Streamable, public cpphots::interfaces::ClonableBase<TimeSurfacePoolCalculator>

Interface for a pool of time surface calculators.

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

Subclassed by cpphots::interfaces::Clonable< TimeSurfacePool, interfaces::TimeSurfacePoolCalculator >, cpphots::Layer

Public Functions

inline virtual ~TimeSurfacePoolCalculator()

Destroy the TimeSurfacePoolCalculator.

virtual void update(uint64_t t, uint16_t x, uint16_t y, uint16_t p) = 0

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

virtual void update(const event &ev) = 0

Update the time context with a new event.

Parameters

ev – the new event

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

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

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

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

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

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

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

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

virtual std::pair<uint16_t, uint16_t> getSize() const = 0

Returns the size of the context.

Returns

{width, height}

virtual void reset() = 0

Reset the time surfaces.

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

virtual TimeSurfacePtr &getSurface(size_t idx) = 0

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

virtual const TimeSurfacePtr &getSurface(size_t idx) const = 0

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

virtual std::vector<TimeSurfaceType> sampleContexts(uint64_t t) = 0

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

virtual size_t getNumSurfaces() const = 0

Get the number of surfaces in the pool.

Returns

number of surfaces