OpenEV
Extending OpenCV to event-based vision
Loading...
Searching...
No Matches
ev::SpaceTime_< T, Options, E > Class Template Reference

This class extends ev::EventImage_<T> to draw the events as a cloud in the x-y-t volume seen in perspective. More...

#include <space-time.hpp>

Inheritance diagram for ev::SpaceTime_< T, Options, E >:
ev::EventImage_< T, RepresentationOptions::NONE, int > ev::AbstractRepresentation_< T, Options, int > ev::Stats_< AbstractRepresentation_< T, Options, int > >

Public Member Functions

 SpaceTime_ (const cv::Size canvas, const cv::Size sensor=cv::Size())
 Construct the canvas.
void setView (const double yaw, const double pitch)
 Set the view angles.
void setDepth (const double depth)
 Set the depth of the box, that is, how long the time axis is drawn.
void showAxes (const bool state, const double length=DEFAULT_AXES_LENGTH)
 Draw the x, y and t axes from the sensor origin, labelled at their ends.
void fadeWithDepth (const bool state, const double strength=DEFAULT_FADE)
 Fade the events towards the background as they recede, so the depth shows.
void setAxesValue (const typename TypeHelper< T >::Type &value)
 Set the value the axes are drawn with.
void setAxesColor (const cv::viz::Color &color)
 Set the colour the axes are drawn with. For more information, please refer here.
double yaw () const
 Yaw of the view.
double pitch () const
 Pitch of the view.
cv::Size sensorSize () const
 Sensor size.
cv::Point2d project (const Event_< E > &e, const double age) const
 Project an event onto the canvas with the current view.
cv::Mat & render ()
 Render the space-time view.
Public Member Functions inherited from ev::EventImage_< T, RepresentationOptions::NONE, int >
 EventImage_ (Args &&...args)
cv::Mat & render ()
Public Member Functions inherited from ev::AbstractRepresentation_< T, Options, int >
std::size_t count () const
 Number of events integrated in the representation.
TimeType firstTimestamp () const
 Timestamp of the oldest event integrated in the representation.
TimeType lastTimestamp () const
 Timestamp of the newest event integrated in the representation.
void clear ()
 Remove all events from the representation.
bool insert (const Event_< int > &e)
 Insert one event in the representation.
void setTimeOffset (const Event_< int > &e)
 Set time offset.
void setValue (const bool polarity, const Type &value)
 Set values for ON and OFF pixels.
void setValues (const Type &positive, const Type &negative, const Type &reset)
 Set values for ON, OFF, and non-activated pixels.
void setColor (const bool polarity, const cv::viz::Color &color)
 Set colors for ON and OFF pixels. For more information, please refer here.
void setColors (const cv::viz::Color &positive, const cv::viz::Color &negative, const cv::viz::Color &reset)
 Set colors for ON, OFF, and non-activated pixels. For more information, please refer here.
void setColormap (const cv::ColormapTypes cm)
 Set colormap for the representation.
Public Member Functions inherited from ev::Stats_< AbstractRepresentation_< T, Options, int > >
ResultType duration () const
 Time difference between the last and the first event.
ResultType rate () const
 Compute event rate as the ratio between the number of events and the time difference between the last and the first event.
ResultType density (const cv::Size size) const
 Compute event density as the ratio between the number of events and the number of pixels.
std::size_t activePixels () const
 Count the pixels with at least one event.
ResultType fillRatio (const cv::Size size) const
 Compute fill ratio as the fraction of pixels with at least one event.
ResultType polarityRatio (const PolarityType p) const
 Compute polarity ratio as the fraction of events with the given polarity.
Event_< ResultType > mean () const
 Compute the mean of the events.
cv::Point_< ResultType > meanPoint () const
 Compute the mean x,y point of the events.
cv::Matx< ResultType, 2, 2 > covariance () const
 Compute the covariance of the x,y coordinates of the events around meanPoint().
cv::Rect boundingBox () const
 Compute the smallest rectangle of pixels containing the events.
ResultType meanTime () const
 Compute the mean time of the events.
ResultType midTime () const
 Calculate the midpoint time between the oldest and the newest event.
std::size_t peak () const
 Find the largest number of events on a single pixel.
ResultType entropy () const
 Compute the Shannon entropy of the spatial distribution of the events.

Static Public Attributes

static constexpr double DEFAULT_YAW = 30.0
static constexpr double DEFAULT_PITCH = 20.0
static constexpr double DEFAULT_DEPTH = 1.0
static constexpr double DISTANCE = 2.5
static constexpr int MARGIN = 2
static constexpr double LABEL_SCALE = 0.35
static constexpr double DEFAULT_AXES_LENGTH = 0.25
static constexpr double DEFAULT_FADE = 0.8

Additional Inherited Members

Public Types inherited from ev::AbstractRepresentation_< T, Options, int >
using Type
Public Types inherited from ev::Stats_< AbstractRepresentation_< T, Options, int > >
using ResultType

Detailed Description

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
class ev::SpaceTime_< T, Options, E >

This class extends ev::EventImage_<T> to draw the events as a cloud in the x-y-t volume seen in perspective.

A background given to clear() is an image in sensor coordinates. It is drawn in perspective on the plane of the oldest events, behind the cloud, and follows the view.

Analogously to OpenCV library, the following aliases are defined for convenience:

SpaceTime_(const cv::Size canvas, const cv::Size sensor=cv::Size())
Construct the canvas.
SpaceTime_< cv::Vec3s > SpaceTime3s
Definition space-time.hpp:192
SpaceTime_< cv::Vec3f > SpaceTime3f
Definition space-time.hpp:198
SpaceTime_< cv::Vec3i > SpaceTime3i
Definition space-time.hpp:196
SpaceTime_< cv::Vec3b > SpaceTime3b
Definition space-time.hpp:190
SpaceTime1 SpaceTime
Definition space-time.hpp:203
SpaceTime_< ushort > SpaceTime1w
Definition space-time.hpp:193
SpaceTime_< short > SpaceTime1s
Definition space-time.hpp:191
SpaceTime_< uchar > SpaceTime1b
Definition space-time.hpp:189
SpaceTime1b SpaceTime1
Definition space-time.hpp:201
SpaceTime_< cv::Vec3d > SpaceTime3d
Definition space-time.hpp:200
SpaceTime_< int > SpaceTime1i
Definition space-time.hpp:195
SpaceTime3b SpaceTime3
Definition space-time.hpp:202
SpaceTime_< cv::Vec3w > SpaceTime3w
Definition space-time.hpp:194
SpaceTime_< double > SpaceTime1d
Definition space-time.hpp:199
SpaceTime_< float > SpaceTime1f
Definition space-time.hpp:197

Constructor & Destructor Documentation

◆ SpaceTime_()

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
ev::SpaceTime_< T, Options, E >::SpaceTime_ ( const cv::Size canvas,
const cv::Size sensor = cv::Size() )
explicit

Construct the canvas.

Parameters
canvasCanvas size in pixels
sensorSensor size in pixels, the canvas size if empty

Member Function Documentation

◆ fadeWithDepth()

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
void ev::SpaceTime_< T, Options, E >::fadeWithDepth ( const bool state,
const double strength = DEFAULT_FADE )
inline

Fade the events towards the background as they recede, so the depth shows.

Parameters
stateTrue to fade them
strengthHow transparent the events on the back face are, from 0, opaque, to 1, invisible

◆ pitch()

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
double ev::SpaceTime_< T, Options, E >::pitch ( ) const
inlinenodiscard

Pitch of the view.

Returns
Pitch in degrees

◆ project()

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
cv::Point2d ev::SpaceTime_< T, Options, E >::project ( const Event_< E > & e,
const double age ) const
nodiscard

Project an event onto the canvas with the current view.

Parameters
eEvent
ageAge of the event between 0, the front face, and 1, the back face
Returns
Canvas coordinates

◆ render()

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
cv::Mat & ev::SpaceTime_< T, Options, E >::render ( )

Render the space-time view.

The canvas is restored, the axes are drawn if enabled, and the events inserted since the last clear() are drawn from the oldest to the newest.

◆ sensorSize()

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
cv::Size ev::SpaceTime_< T, Options, E >::sensorSize ( ) const
inlinenodiscard

Sensor size.

Returns
Sensor size in pixels

◆ setAxesColor()

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
void ev::SpaceTime_< T, Options, E >::setAxesColor ( const cv::viz::Color & color)
inline

Set the colour the axes are drawn with. For more information, please refer here.

Parameters
colorAxes colour

◆ setAxesValue()

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
void ev::SpaceTime_< T, Options, E >::setAxesValue ( const typename TypeHelper< T >::Type & value)
inline

Set the value the axes are drawn with.

Parameters
valueAxes value

◆ setDepth()

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
void ev::SpaceTime_< T, Options, E >::setDepth ( const double depth)

Set the depth of the box, that is, how long the time axis is drawn.

Parameters
depthDepth relative to the sensor width

◆ setView()

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
void ev::SpaceTime_< T, Options, E >::setView ( const double yaw,
const double pitch )

Set the view angles.

Parameters
yawRotation around the vertical axis in degrees, positive turns the right side of the sensor away
pitchRotation around the horizontal axis in degrees, positive shows the sensor from above

◆ showAxes()

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
void ev::SpaceTime_< T, Options, E >::showAxes ( const bool state,
const double length = DEFAULT_AXES_LENGTH )
inline

Draw the x, y and t axes from the sensor origin, labelled at their ends.

Parameters
stateTrue to draw them
lengthLength of each axis as a fraction of its side of the box

◆ yaw()

template<typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
double ev::SpaceTime_< T, Options, E >::yaw ( ) const
inlinenodiscard

Yaw of the view.

Returns
Yaw in degrees

The documentation for this class was generated from the following file:
  • modules/representations/include/openev/representations/space-time.hpp