]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/commitdiff
Fix bugs in some FFT classes
authorMichal Sojka <michal.sojka@cvut.cz>
Sun, 23 Sep 2018 07:13:43 +0000 (09:13 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Sun, 23 Sep 2018 07:18:38 +0000 (09:18 +0200)
src/fft_fftw.cpp
src/fft_opencv.cpp

index 4d77600357331a0df41ebc36bcdb3d5d88125744..e5457f3293a4e2f762665ac535e4d4a23471900f 100644 (file)
@@ -98,7 +98,7 @@ void Fftw::init(unsigned width, unsigned height, unsigned num_of_feats, unsigned
         float *out = reinterpret_cast<float *>(out_i.data);
         int rank = 2;
         int n[] = {int(m_height), int(m_width)};
-        int howmany = int(m_num_of_feats);
+        int howmany = 1;
         int idist = int(m_height * (m_width / 2 + 1)), odist = 1;
         int istride = 1, ostride = int(m_num_of_feats);
         int inembed[] = {int(m_height), int(m_width / 2 + 1)}, *onembed = n;
@@ -136,7 +136,7 @@ void Fftw::init(unsigned width, unsigned height, unsigned num_of_feats, unsigned
         int n[] = {int(m_height), int(m_width)};
         int howmany = IF_BIG_BATCH(m_num_of_scales, 1);
         int idist = m_height * (m_width / 2 + 1), odist = 1;
-        int istride = 1, ostride = IF_BIG_BATCH(m_num_of_scales, 1);
+        int istride = 1, ostride = 1;
         int inembed[] = {int(m_height), int(m_width / 2 + 1)}, *onembed = n;
 
         FFTW_PLAN_WITH_THREADS();
index 1477671fbd4e9d327a7ddd3136e49552e7906110..5901f1526961f659a7fb491df126a07a2cb0baca 100644 (file)
@@ -24,13 +24,12 @@ void FftOpencv::forward_window(MatScaleFeats &feat, ComplexMat &complex_result,
 {
     Fft::forward_window(feat, complex_result, temp);
 
-    uint n_channels = feat.size[0];
-    for (uint i = 0; i < n_channels; ++i) {
+    for (uint i = 0; i < uint(feat.size[0]); ++i) {
         for (uint j = 0; j < uint(feat.size[1]); ++j) {
             cv::Mat complex_res;
             cv::Mat channel = feat.plane(i, j);
             cv::dft(channel.mul(m_window), complex_res, cv::DFT_COMPLEX_OUTPUT);
-            complex_result.set_channel(int(i), complex_res);
+            complex_result.set_channel(int(j), complex_res);
         }
     }
 }