From: Michal Sojka Date: Sun, 23 Sep 2018 07:13:43 +0000 (+0200) Subject: Fix bugs in some FFT classes X-Git-Url: http://rtime.felk.cvut.cz/gitweb/hercules2020/kcf.git/commitdiff_plain/d99ca2fbb13623ab543823cc25e6abe1c8897438 Fix bugs in some FFT classes --- diff --git a/src/fft_fftw.cpp b/src/fft_fftw.cpp index 4d77600..e5457f3 100644 --- a/src/fft_fftw.cpp +++ b/src/fft_fftw.cpp @@ -98,7 +98,7 @@ void Fftw::init(unsigned width, unsigned height, unsigned num_of_feats, unsigned float *out = reinterpret_cast(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(); diff --git a/src/fft_opencv.cpp b/src/fft_opencv.cpp index 1477671..5901f15 100644 --- a/src/fft_opencv.cpp +++ b/src/fft_opencv.cpp @@ -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); } } }