This is an example of how to use the EventHistogram_<T> class.
#include <cstdlib>
#include <memory>
#include <opencv2/core.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/core/mat.inl.hpp>
#include <opencv2/core/matx.hpp>
#include <opencv2/core/traits.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/viz/types.hpp>
#include <random>
#include <string>
cv::resize(h.
render(), resized,
ev::Size(500, 500), 0, 0, cv::INTER_NEAREST);
cv::imshow("example-event-image", resized);
cv::waitKey(5);
}
int main(int , const char * []) {
histogram.setColors(cv::viz::Color::bluberry(), cv::viz::Color::cherry(), cv::viz::Color::black());
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dis(0, 9);
for(int k = 1; k < 5; k++) {
int row = 0;
int col = 0;
int direction = 0;
int offset = 0;
double t = 0;
while(offset < 0.1 * k * histogram.cols) {
t += dis(gen);
switch(direction) {
case 0:
col++;
if(col >= histogram.cols - 1 - offset) {
direction++;
}
break;
case 1:
row++;
if(row >= histogram.rows - 1 - offset) {
direction++;
}
break;
case 2:
col--;
if(col <= offset) {
direction++;
offset++;
}
break;
case 3:
row--;
if(row <= offset) {
direction = 0;
}
default:
break;
}
show(histogram);
}
}
return 0;
}
cv::Mat & render()
Render event histogram matrix.
EventHistogram_< cv::Vec3b > EventHistogram3b
Definition event-histogram.hpp:80
Basic event-based vision structures based on OpenCV components.
constexpr bool POSITIVE
Definition types.hpp:27
Size2 Size
Definition types.hpp:342
Eventi Event
Definition types.hpp:244