OpenEV
Extending OpenCV to event-based vision
Toggle main menu visibility
Loading...
Searching...
No Matches
example-point-cloud.cpp
This is an example of how to use the PointCloud_<T> class.
#include "
openev/core/types.hpp
"
#include "
openev/representations/point-cloud.hpp
"
#include <opencv2/core/mat.inl.hpp>
#include <opencv2/core/traits.hpp>
#include <random>
int
main(
int
/*argc*/
,
const
char
*
/*argv*/
[]) {
ev::PointCloud
pointcloud;
int
row = 0;
int
col = 0;
int
direction = 0;
int
offset = 0;
double
t = 0;
// Initialize random number generator
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<int> dist(0, 1);
while
(offset < 30) {
t += 0.1;
pointcloud.
insert
(
ev::Event
(col, row, t,
static_cast<
bool
>
(dist(gen)) ?
ev::POSITIVE
:
ev::NEGATIVE
));
switch
(direction) {
case
0:
col++;
if
(col >= 50 - offset) {
direction++;
}
break
;
case
1:
row++;
if
(row >= 50 - offset) {
direction++;
}
break
;
case
2:
col--;
if
(col <= offset) {
direction++;
offset++;
}
break
;
case
3:
row--;
if
(row <= offset) {
direction = 0;
}
default
:
break
;
}
}
pointcloud.
visualize
(0, 0.4);
return
0;
}
ev::AbstractRepresentation_::insert
bool insert(const Event_< E > &e)
Insert one event in the representation.
ev::PointCloud_::visualize
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.
point-cloud.hpp
Point cloud of events.
ev::PointCloud
PointCloud1 PointCloud
Definition
point-cloud.hpp:93
types.hpp
Basic event-based vision structures based on OpenCV components.
ev::POSITIVE
constexpr PolarityType POSITIVE
Definition
types.hpp:29
ev::Event
Eventi Event
Definition
types.hpp:252
ev::NEGATIVE
constexpr PolarityType NEGATIVE
Definition
types.hpp:30
Generated by
1.17.0