OpenEV
Extending OpenCV to event-based vision
Loading...
Searching...
No Matches
point-cloud.hpp
Go to the documentation of this file.
1
6#ifndef OPENEV_REPRESENTATIONS_POINT_CLOUD_HPP
7#define OPENEV_REPRESENTATIONS_POINT_CLOUD_HPP
8
10#include "openev/options.hpp"
12#include <array>
13#include <opencv2/core/hal/interface.h>
14#include <opencv2/core/matx.hpp>
15#include <opencv2/core/types.hpp>
16#include <string>
17#include <vector>
18
19#if OE_HAVE_VIZ
20#include <opencv2/viz/viz3d.hpp>
21#endif
22
23namespace ev {
46template <typename T, const RepresentationOptions Options = RepresentationOptions::NONE>
47class PointCloud_ : public AbstractRepresentation_<T, Options> {
48public:
53 [[nodiscard]] inline bool contains(const Event &e) const {
54 return std::find(points_[e.p].begin(), points_[e.p].end(), cv::Point3f(e.x, e.y, e.t)) != points_[e.p].end();
55 }
56
57#if OE_HAVE_VIZ
65 void visualize(const int t, const double time_scale = 1.0, const double axis_size = 1.0, const double point_size = 2.0);
66#endif
67
68private:
69 std::array<std::vector<cv::Point3_<typename TypeHelper<T>::FloatingPointType>>, 2> points_;
70#if OE_HAVE_VIZ
71 cv::viz::Viz3d window_{"OpenEV"};
72#endif
73
74 void clear_() override;
75 void clear_(const cv::Mat &background) override;
76 bool insert_(const Event &e) override;
77};
93} // namespace ev
94
96#include "openev/representations/point-cloud.tpp"
99#endif // OPENEV_REPRESENTATIONS_POINT_CLOUD_HPP
Event abstract representation.
This is an auxiliary class. This class cannot be instanced.
Definition abstract-representation.hpp:119
This class extends cv::Point_<T> for event data. For more information, please refer here.
Definition types.hpp:60
bool p
Definition types.hpp:63
double t
Definition types.hpp:62
This class is used to represent events as point clouds.
Definition point-cloud.hpp:47
bool contains(const Event &e) const
Check if an event is included in the point cloud.
Definition point-cloud.hpp:53
OpenEV compilation options.
Basic event-based vision structures based on OpenCV components.