OpenEV
Extending OpenCV to event-based vision
 
Loading...
Searching...
No Matches
efft.hpp
Go to the documentation of this file.
1
6#ifndef OPENEV_ALGORITHMS_EFFT_HPP
7#define OPENEV_ALGORITHMS_EFFT_HPP
8
9#include "efft/include/efft.hpp"
10#include <complex>
11#include <eigen3/Eigen/Core>
12#include <opencv2/core/hal/interface.h>
13#include <opencv2/core/mat.hpp>
14#include <opencv2/core/mat.inl.hpp>
15
16namespace ev {
17template <typename T>
18class Event_;
19
20template <unsigned int N>
21class efft : public eFFT<N> {
22public:
23 efft() {
24 eFFT<N>::initialize();
25 }
26
27 template <typename E = int>
28 inline bool update(const Event_<E> &e, const bool state) {
29 return eFFT<N>::update({static_cast<unsigned int>(e.y), static_cast<unsigned int>(e.x), state});
30 }
31
32 template <typename E = int>
33 inline bool insert(const Event_<E> &e) {
34 return eFFT<N>::update({static_cast<unsigned int>(e.y), static_cast<unsigned int>(e.x), true});
35 }
36
37 template <typename E = int>
38 inline bool extract(const Event_<E> &e) {
39 return eFFT<N>::update({static_cast<unsigned int>(e.y), static_cast<unsigned int>(e.x), false});
40 }
41
42 inline cv::Mat mat() {
43 cv::Mat cvMat(N, N, CV_32FC2);
44 Eigen::Map<Eigen::Matrix<std::complex<float>, N, N, Eigen::RowMajor>>(reinterpret_cast<std::complex<float> *>(cvMat.data)) = eFFT<N>::getFFT();
45 return cvMat;
46 }
47};
48
49} // namespace ev
50
51#endif // OPENEV_ALGORITHMS_EFFT_HPP
This class extends cv::Point_<T> for event data. For more information, please refer here.
Definition types.hpp:55