From 250e9dc2a4351b2d8f6a76aafd0f3f91e71e830f Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sat, 13 Oct 2018 13:41:12 +0200 Subject: [PATCH 1/1] Add more assertions about FFT arguments This is to be sure that after adding rotation, all matrix dimensions are still correct. --- src/fft.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fft.cpp b/src/fft.cpp index 76f6f68..1fe90d0 100644 --- a/src/fft.cpp +++ b/src/fft.cpp @@ -67,6 +67,10 @@ void Fft::forward_window(MatScaleFeats &patch_feats, ComplexMat &complex_result, assert(tmp.size[2] == patch_feats.size[2]); assert(tmp.size[3] == patch_feats.size[3]); + assert(int(complex_result.cols) == freq_size(cv::Size(m_width, m_height)).width); + assert(int(complex_result.rows) == freq_size(cv::Size(m_width, m_height)).height); + assert(complex_result.channels() == uint(patch_feats.size[0] * patch_feats.size[1])); + (void)patch_feats; (void)complex_result; (void)tmp; @@ -85,6 +89,10 @@ void Fft::inverse(ComplexMat &complex_input, MatScales &real_result) assert(real_result.size[1] == int(m_height)); assert(real_result.size[2] == int(m_width)); + assert(int(complex_input.cols) == freq_size(cv::Size(m_width, m_height)).width); + assert(int(complex_input.rows) == freq_size(cv::Size(m_width, m_height)).height); + assert(complex_input.channels() == uint(real_result.size[0])); + (void)complex_input; (void)real_result; } -- 2.39.2