Class WeightedLinearTimeSurface
Defined in File time_surface.h
Inheritance Relationships
Base Type
public cpphots::interfaces::Clonable< WeightedLinearTimeSurface, LinearTimeSurface >(Template Struct Clonable)
Class Documentation
-
class cpphots::WeightedLinearTimeSurface : public cpphots::interfaces::Clonable<WeightedLinearTimeSurface, LinearTimeSurface>
Class that can compute linear time surfaces, with weighted output.
This class keeps track of the time context for the current stream of events and can compute the time surface for new ones.
The time surface has a linear activation as described in (Maro et al., 2020).
Output time surfaces and time context are weighted by a weight matrix.
Public Functions
-
WeightedLinearTimeSurface()
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.
-
WeightedLinearTimeSurface(uint16_t width, uint16_t height, uint16_t Rx, uint16_t Ry, TimeSurfaceScalarType tau, const TimeSurfaceType &weightmatrix)
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.
The weight matrix must have the same size as the context.
- 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
weightmatrix – matrix used to weight the time surfaces
-
virtual std::pair<TimeSurfaceType, bool> compute(uint64_t t, uint16_t x, uint16_t y) 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.
The output time surface is weighted.
- 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
-
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.
The output time surface is weighted.
- Parameters
ev – the event
- Returns
a std::pair with the computed time surface and whether the surface is valid or not
-
virtual TimeSurfaceType sampleContext(uint64_t t) const override
Sample and decay all temporal context.
This functions applies the decay to the whole temporal context and returns it.
The sampled context is weighted.
- Parameters
t – sample time
- Returns
decayed temporal context
-
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
-
WeightedLinearTimeSurface()