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 "openev/core/types.hpp"
11#include <complex>
12#include <eigen3/Eigen/Core>
13#include <opencv2/core/hal/interface.h>
14#include <opencv2/core/mat.hpp>
15#include <opencv2/core/mat.inl.hpp>
16#include <opencv2/core/matx.hpp>
17
18namespace ev {
19template <typename T>
20class Event_;
21
22template <unsigned int N>
23class efft : public eFFT<N> {
24public:
25 efft() {
26 eFFT<N>::initialize();
27 }
28
29 template <typename E = int>
30 inline bool update(const Event_<E> &e, const bool state) {
31 return eFFT<N>::update({static_cast<unsigned int>(e.y), static_cast<unsigned int>(e.x), state});
32 }
33
34 template <typename E = int>
35 inline bool insert(const Event_<E> &e) {
36 return eFFT<N>::update({static_cast<unsigned int>(e.y), static_cast<unsigned int>(e.x), true});
37 }
38
39 template <typename E = int>
40 inline bool extract(const Event_<E> &e) {
41 return eFFT<N>::update({static_cast<unsigned int>(e.y), static_cast<unsigned int>(e.x), false});
42 }
43
44 inline cv::Mat mat() {
45 cv::Mat cvMat(N, N, CV_32FC2);
46 Eigen::Map<Eigen::Matrix<std::complex<float>, N, N, Eigen::RowMajor>>(reinterpret_cast<std::complex<float> *>(cvMat.data)) = eFFT<N>::getFFT();
47 return cvMat;
48 }
49};
50
51} // namespace ev
52
53#endif // OPENEV_ALGORITHMS_EFFT_HPP
This class extends cv::Point_<T> for event data. For more information, please refer here.
Definition types.hpp:62
Basic event-based vision structures based on OpenCV components.