14 template <
typename... Args>
15 explicit TimeMat(Args &&...args) : cv::Mat_<double>(std::forward<Args>(args)...) {
20 inline const double &insert(
const Event_<T> &e) {
21 if constexpr(std::is_floating_point<T>::value) {
22 return cv::Mat_<double>::operator()(std::round(e.y), std::round(e.x)) = e.
t;
24 return cv::Mat_<double>::operator()(e) = e.
t;
29 inline const double &emplace(
const T x,
const T y,
const double t) {
30 if constexpr(std::is_floating_point<T>::value) {
31 return cv::Mat_<double>::operator()(std::round(y), std::round(x)) = t;
33 return cv::Mat_<double>::operator()(y, x) = t;
38 cv::Mat_<double>::setTo(0);
44 template <
typename... Args>
45 explicit PolarityMat(Args &&...args) : cv::Mat_<bool>(std::forward<Args>(args)...) {
50 inline const bool &insert(
const Event_<T> &e) {
51 if constexpr(std::is_floating_point<T>::value) {
52 return cv::Mat_<bool>::operator()(std::round(e.y), std::round(e.x)) = e.
p;
54 return cv::Mat_<bool>::operator()(e) = e.
p;
59 inline const bool &emplace(
const T x,
const T y,
const bool p) {
60 if constexpr(std::is_floating_point<T>::value) {
61 return cv::Mat_<bool>::operator()(std::round(y), std::round(x)) = p;
63 return cv::Mat_<bool>::operator()(y, x) = p;
68 cv::Mat_<bool>::setTo(
false);
74 template <
typename... Args>
75 explicit CounterMat(Args &&...args) : cv::Mat_<int>(std::forward<Args>(args)...) {
80 inline const int &insert(
const Event_<T> &e) {
81 if constexpr(std::is_floating_point<T>::value) {
82 return cv::Mat_<int>::operator()(std::round(e.y), std::round(e.x)) += (e.
p ? +1 : -1);
84 return cv::Mat_<int>::operator()(e) += (e.
p ? +1 : -1);
89 inline const int &emplace(
const T x,
const T y,
const bool p) {
90 if constexpr(std::is_floating_point<T>::value) {
91 return cv::Mat_<int>::operator()(std::round(y), std::round(x)) += (p ? +1 : -1);
93 return cv::Mat_<int>::operator()(y, x) += (p ? +1 : -1);
98 cv::Mat_<int>::setTo(0);