Commit 2395654c authored by Leonid Beynenson's avatar Leonid Beynenson

Made changes in the stitching log macros: now the function stitchingLogLevel()…

Made changes in the stitching log macros: now the function stitchingLogLevel() may be used to make the stitching classes more/less verbose.
parent 6f99447f
......@@ -54,7 +54,7 @@
#include <iostream>
#include <sstream>
#include <android/log.h>
#define LOG(msg) \
#define LOG_STITCHING_MSG(msg) \
do { \
std::stringstream _os; \
_os << msg; \
......@@ -62,13 +62,33 @@
} while(0);
#else
#include <iostream>
#define LOG(msg) do { std::cout << msg; std::cout.flush(); } while(0);
#define LOG_STITCHING_MSG(msg) do { std::cout << msg; std::cout.flush(); } while(0);
#endif
#else
#define LOG(msg)
#define LOG_STITCHING_MSG(msg)
#endif
#define LOG_(_level, _msg) \
do { \
if ((_level) >= ::cv::detail::stitchingLogLevel()) { \
LOG_STITCHING_MSG(_msg); \
} \
} while(0)
#define LOG(msg) LOG_(1, msg)
#define LOG_CHAT(msg) LOG_(0, msg)
#define LOGLN(msg) LOG(msg << std::endl)
#define LOGLN_CHAT(msg) LOG_CHAT(msg << std::endl)
//#if DEBUG_LOG_CHAT
// #define LOG_CHAT(msg) LOG(msg)
// #define LOGLN_CHAT(msg) LOGLN(msg)
//#else
// #define LOG_CHAT(msg) do{}while(0)
// #define LOGLN_CHAT(msg) do{}while(0)
//#endif
namespace cv {
namespace detail {
......@@ -128,6 +148,8 @@ Point CV_EXPORTS resultTl(const std::vector<Point> &corners);
// Returns random 'count' element subset of the {0,1,...,size-1} set
void CV_EXPORTS selectRandomSubset(int count, int size, std::vector<int> &subset);
int& CV_EXPORTS stitchingLogLevel();
} // namespace detail
} // namespace cv
......
......@@ -491,7 +491,7 @@ void FeaturesMatcher::operator ()(const vector<ImageFeatures> &features, vector<
parallel_for(BlockedRange(0, static_cast<int>(near_pairs.size())), body);
else
body(BlockedRange(0, static_cast<int>(near_pairs.size())));
LOGLN("");
LOGLN_CHAT("");
}
......
......@@ -171,7 +171,7 @@ void BundleAdjusterBase::estimate(const vector<ImageFeatures> &features,
const vector<MatchesInfo> &pairwise_matches,
vector<CameraParams> &cameras)
{
LOG("Bundle adjustment");
LOG_CHAT("Bundle adjustment");
int64 t = getTickCount();
num_images_ = static_cast<int>(features.size());
......@@ -230,16 +230,16 @@ void BundleAdjusterBase::estimate(const vector<ImageFeatures> &features,
if (_err)
{
calcError(err);
LOG(".");
LOG_CHAT(".");
iter++;
CvMat tmp = err;
cvCopy(&tmp, _err);
}
}
LOGLN("");
LOGLN("Bundle adjustment, final RMS error: " << sqrt(err.dot(err) / total_num_matches_));
LOGLN("Bundle adjustment, iterations done: " << iter);
LOGLN_CHAT("");
LOGLN_CHAT("Bundle adjustment, final RMS error: " << sqrt(err.dot(err) / total_num_matches_));
LOGLN_CHAT("Bundle adjustment, iterations done: " << iter);
obtainRefinedCameraParams(cameras);
......@@ -251,7 +251,7 @@ void BundleAdjusterBase::estimate(const vector<ImageFeatures> &features,
for (int i = 0; i < num_images_; ++i)
cameras[i].R = R_inv * cameras[i].R;
LOGLN("Bundle adjustment, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");
LOGLN_CHAT("Bundle adjustment, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");
}
......
......@@ -165,5 +165,11 @@ void selectRandomSubset(int count, int size, vector<int> &subset)
}
}
int& stitchingLogLevel()
{
static int _log_level=1;
return _log_level;
}
} // namespace detail
} // namespace cv
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment