]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/blob - src/fft.h
Move patch capture for visual debug after scale step
[hercules2020/kcf.git] / src / fft.h
1
2 #ifndef FFT_H
3 #define FFT_H
4
5 #include <opencv2/opencv.hpp>
6 #include <vector>
7 #include <cassert>
8 #include "complexmat.hpp"
9
10 #ifdef BIG_BATCH
11 #define BIG_BATCH_MODE 1
12 #define IF_BIG_BATCH(true, false) true
13 #else
14 #define BIG_BATCH_MODE 0
15 #define IF_BIG_BATCH(true, false) false
16 #endif
17
18 class Fft
19 {
20 public:
21     virtual void init(unsigned width, unsigned height, unsigned num_of_feats, unsigned num_of_scales);
22     virtual void set_window(const MatDynMem &window);
23     virtual void forward(const MatScales &real_input, ComplexMat &complex_result);
24     virtual void forward_window(MatScaleFeats &patch_feats_in, ComplexMat &complex_result, MatScaleFeats &tmp);
25     virtual void inverse(ComplexMat &complex_input, MatScales &real_result);
26     virtual ~Fft() = 0;
27
28     static cv::Size freq_size(cv::Size space_size)
29     {
30         cv::Size ret(space_size);
31 #if defined(CUFFT) || defined(FFTW)
32         ret.width = space_size.width / 2 + 1;
33 #endif
34         return ret;
35     }
36
37 protected:
38     unsigned m_width, m_height, m_num_of_feats;
39 #ifdef BIG_BATCH
40     unsigned m_num_of_scales;
41 #endif
42 };
43
44 #endif // FFT_H