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 <array>
11#include <opencv2/core/hal/interface.h>
12#include <opencv2/core/matx.hpp>
13#include <opencv2/core/types.hpp>
14#include <opencv2/viz/viz3d.hpp>
15#include <vector>
16
17namespace cv {
18class Mat;
19} // namespace cv
20
21namespace ev {
22[[maybe_unused]] constexpr bool USING_POINT_CLOUD_HPP = true;
23
25template <typename T>
26class Event_;
28
51template <typename T, const RepresentationOptions Options = RepresentationOptions::NONE, typename E = int>
52class PointCloud_ : public AbstractRepresentation_<T, Options, E> {
53public:
58 [[nodiscard]] inline bool contains(const Event_<E> &e) const {
59 return std::find(points_[e.p].begin(), points_[e.p].end(), cv::Point3f(e.x, e.y, e.t)) != points_[e.p].end();
60 }
61
69 void visualize(const int t, const double time_scale = 1.0, const double axis_size = 1.0, const double point_size = 2.0);
70
75 [[nodiscard]] inline cv::viz::Viz3d &window() {
76 return window_;
77 }
78
79private:
80 std::array<std::vector<cv::Point3_<typename TypeHelper<T>::FloatingPointType>>, 2> points_;
81 cv::viz::Viz3d window_{"OpenEV"};
82
83 [[nodiscard]] cv::Size frameSize_() const override {
84 return {};
85 }
86
87 void clear_() override;
88 void clear_(const cv::Mat &background) override;
89 bool insert_(const Event_<E> &e) override;
90};
106} // namespace ev
107
109#include "openev/representations/point-cloud.tpp"
111
112#endif // OPENEV_REPRESENTATIONS_POINT_CLOUD_HPP
Event abstract representation.
This is an auxiliary class. This class cannot be instanced.
Definition abstract-representation.hpp:126
This class extends cv::Point_<T> for event data. For more information, please refer here.
Definition types.hpp:86
PolarityType p
Definition types.hpp:91
TimeType t
Definition types.hpp:90
This class is used to represent events as point clouds.
Definition point-cloud.hpp:52
void visualize(const int t, const double time_scale=1.0, const double axis_size=1.0, const double point_size=2.0)
Visualize point cloud.
cv::viz::Viz3d & window()
Window the point cloud is shown in, to set the viewpoint or register callbacks.
Definition point-cloud.hpp:75
bool contains(const Event_< E > &e) const
Check if an event is included in the point cloud.
Definition point-cloud.hpp:58
PointCloud_< cv::Vec3s > PointCloud3s
Definition point-cloud.hpp:94
PointCloud_< float > PointCloud1f
Definition point-cloud.hpp:99
PointCloud1b PointCloud1
Definition point-cloud.hpp:103
PointCloud_< short > PointCloud1s
Definition point-cloud.hpp:93
PointCloud_< double > PointCloud1d
Definition point-cloud.hpp:101
PointCloud_< cv::Vec3b > PointCloud3b
Definition point-cloud.hpp:92
PointCloud3b PointCloud3
Definition point-cloud.hpp:104
PointCloud_< cv::Vec3f > PointCloud3f
Definition point-cloud.hpp:100
PointCloud1 PointCloud
Definition point-cloud.hpp:105
PointCloud_< cv::Vec3w > PointCloud3w
Definition point-cloud.hpp:96
PointCloud_< cv::Vec3d > PointCloud3d
Definition point-cloud.hpp:102
PointCloud_< int > PointCloud1i
Definition point-cloud.hpp:97
PointCloud_< uchar > PointCloud1b
Definition point-cloud.hpp:91
PointCloud_< cv::Vec3i > PointCloud3i
Definition point-cloud.hpp:98
PointCloud_< ushort > PointCloud1w
Definition point-cloud.hpp:95