]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/blob - src/debug.cpp
Allow using debug functions in other files than kcf.cpp
[hercules2020/kcf.git] / src / debug.cpp
1 #include "debug.h"
2
3 std::ostream &operator<<(std::ostream &os, const DbgTracer::Printer<cv::Mat> &p)
4 {
5     IOSave s(os);
6     os << std::setprecision(3);
7     os << p.obj.size << " " << p.obj.channels() << "ch ";// << static_cast<const void *>(p.obj.data);
8     os << " = [ ";
9     constexpr size_t num = 10;
10     for (size_t i = 0; i < std::min(num, p.obj.total()); ++i)
11         os << p.obj.ptr<float>()[i] << ", ";
12     os << (num < p.obj.total() ? "... ]" : "]");
13     return os;
14 }
15
16 std::ostream &operator<<(std::ostream &os, const DbgTracer::Printer<ComplexMat> &p)
17 {
18     IOSave s(os);
19     os << std::setprecision(3);
20     os << "<cplx> " << p.obj.size() << " " << p.obj.channels() << "ch "; // << p.obj.get_p_data();
21     os << " = [ ";
22     constexpr int num = 10;
23     for (int i = 0; i < std::min(num, p.obj.size().area()); ++i)
24         os << p.obj.get_p_data()[i] << ", ";
25     os << (num < p.obj.size().area() ? "... ]" : "]");
26     return os;
27 }