Class TimeSurfaceBase

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class cpphots::TimeSurfaceBase : public cpphots::interfaces::TimeSurfaceCalculator

Base class for classes that can compute time surfaces.

This class keeps track of the time context for the current stream of events, but it’s up to the suclasses to compute the time surfaces.

Subclassed by cpphots::interfaces::Clonable< LinearTimeSurface, TimeSurfaceBase >

Public Functions

TimeSurfaceBase()

Construct a new Time Surface object.

This constructor is provided only to create containers with time surfaces instances or to load a time surface from file. It should not be used to create an usable time surface object.

TimeSurfaceBase(uint16_t width, uint16_t height, uint16_t Rx, uint16_t Ry, TimeSurfaceScalarType tau)

Construct a new Time Surface object.

The time context is initalized to -tau.

It is possible to use the whole time context in any dimension to compute the surfaces by setting Rx or Ry to 0. However, this can break the assumption that the current event is centered in the time surface.

Parameters
  • width – width of the full time context

  • height – height of the full time context

  • Rx – horizontal radius of the window on which surfaces are computed (0 to use the full width)

  • Ry – vertical radius of the window on which surfaces are computed (0 to use the full height)

  • tau – time constant of the surface

virtual void update(uint64_t t, uint16_t x, uint16_t y) 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

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> updateAndCompute(uint64_t t, uint16_t x, uint16_t y) 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

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 const TimeSurfaceType &getFullContext() const override

Get the temporal context.

This function returns the full temporal context (including padding) on which surfaces are computed.

You may want to use getContext() in normal circumnstances.

Returns

the temporal context

virtual TimeSurfaceType getContext() const override

Get the temporal context.

This function returns the whole temporal context on which surfaces are computed.

Returns

the temporal context

virtual void reset() override

Reset the time context.

The time context is reset to -tau

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

Returns the size of the context.

Returns

{width, height}

inline virtual uint16_t getWx() const override

Get the horizontal size of the window.

Returns

the horizontal size of the window

inline virtual uint16_t getWy() const override

Get the vertical size of the window.

Returns

the vertical size of the window

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

Insert to stream.

Does not save the current time context.

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.

Parameters

in – stream where to extract from

Protected Attributes

TimeSurfaceType context

Time context.

uint16_t width

Width of the context.

uint16_t height

Height of the context.

uint16_t Rx

Horizontal radius of the window.

uint16_t Ry

Vertical radius of the window.

uint16_t Wx

Horizontal size of the window.

uint16_t Wy

Vertical size of the window.

TimeSurfaceScalarType tau

Time constant.

uint16_t min_events

Minimum number of events for a valid surface.