28 using cv::Mat_<Tb>::Mat_;
36 inline Tb emplace(
const T x,
const T y) {
41 cv::Mat_<Tb>::setTo(0);
44 static constexpr Tb ON = std::numeric_limits<Tb>::max();
45 static constexpr Tb OFF =
static_cast<Tb
>(0);
47 friend std::ostream &operator<<(std::ostream &os,
const Binary_ &binary) {
48 os <<
"Binary " << binary.cols <<
"x" << binary.rows;
54 inline Tb set(
const T x,
const T y) {
55 if constexpr(std::is_floating_point_v<T>) {
56 return *(this->
template ptr<Tb>(std::lround(y)) + std::lround(x)) = ON;
58 return *(this->
template ptr<Tb>(y) + x) = ON;
64class Time :
public cv::Mat_<double> {
66 using cv::Mat_<
double>::Mat_;
69 inline double insert(
const Event_<T> &e) {
70 return set(e.x, e.y, e.
t);
74 inline double emplace(
const T x,
const T y,
const double t) {
79 cv::Mat_<double>::setTo(0);
82 friend std::ostream &operator<<(std::ostream &os,
const Time &time) {
83 os <<
"Time " << time.cols <<
"x" << time.rows;
89 inline double set(
const T x,
const T y,
const double t) {
90 if constexpr(std::is_floating_point_v<T>) {
91 return *(this->ptr<double>(std::lround(y)) + std::lround(x)) = t;
93 return *(this->ptr<double>(y) + x) = t;
134 using cv::Mat_<
int>::Mat_;
136 template <
typename T>
138 return set(e.x, e.y, e.
p);
141 template <
typename T>
142 inline int emplace(
const T x,
const T y,
const bool p) {
146 inline void clear() {
147 cv::Mat_<int>::setTo(0);
150 friend std::ostream &operator<<(std::ostream &os,
const Counter &counter) {
151 os <<
"Counter " << counter.cols <<
"x" << counter.rows;
156 template <
typename T>
157 inline int set(
const T x,
const T y,
const bool p) {
158 if constexpr(std::is_floating_point_v<T>) {
159 return *(this->ptr<int>(std::lround(y)) + std::lround(x)) += (p ? +1 : -1);
161 return *(this->ptr<int>(y) + x) += (p ? +1 : -1);