From: Michal Sojka Date: Thu, 4 Oct 2018 11:01:36 +0000 (+0200) Subject: debug: Round low values to zero when printing them X-Git-Url: http://rtime.felk.cvut.cz/gitweb/hercules2020/kcf.git/commitdiff_plain/3201116062300ef82b40d5d6d17eef4df27911f6?ds=sidebyside debug: Round low values to zero when printing them This is to make comparison of outputs of different implementations easier. --- diff --git a/src/debug.cpp b/src/debug.cpp index 94cba13..7a09f4c 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -23,8 +23,14 @@ std::ostream &operator<<(std::ostream &os, const DbgTracer::Printer for (uint s = 0; s < p.obj.n_scales; ++s) { uint ofs = s * p.obj.rows * p.obj.cols * p.obj.n_channels / p.obj.n_scales; os << " = [ "; - for (int i = 0; i < std::min(num, p.obj.size().area()); ++i) - os << p.obj.get_p_data()[ofs + i] << ", "; + for (int i = 0; i < std::min(num, p.obj.size().area()); ++i) { + std::complex c = p.obj.get_p_data()[ofs + i]; + if (fabs(c.real()) < 5e-7) + c = std::complex(0, c.imag()); + if (fabs(c.imag()) < 5e-7) + c = std::complex(c.real(), 0); + os << c << ", "; + } os << (num < p.obj.size().area() ? "... ]" : "]"); os << std::endl << std::string(20, ' '); }