Made changes in the stitching log macros: now the function stitchingLogLevel() may be used to make the stitching classes more/less verbose.
This commit is contained in:
parent
6f99447fbf
commit
2395654cbf
@ -54,7 +54,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#define LOG(msg) \
|
#define LOG_STITCHING_MSG(msg) \
|
||||||
do { \
|
do { \
|
||||||
std::stringstream _os; \
|
std::stringstream _os; \
|
||||||
_os << msg; \
|
_os << msg; \
|
||||||
@ -62,13 +62,33 @@
|
|||||||
} while(0);
|
} while(0);
|
||||||
#else
|
#else
|
||||||
#include <iostream>
|
#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
|
#endif
|
||||||
#else
|
#else
|
||||||
#define LOG(msg)
|
#define LOG_STITCHING_MSG(msg)
|
||||||
#endif
|
#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(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 cv {
|
||||||
namespace detail {
|
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
|
// Returns random 'count' element subset of the {0,1,...,size-1} set
|
||||||
void CV_EXPORTS selectRandomSubset(int count, int size, std::vector<int> &subset);
|
void CV_EXPORTS selectRandomSubset(int count, int size, std::vector<int> &subset);
|
||||||
|
|
||||||
|
int& CV_EXPORTS stitchingLogLevel();
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace cv
|
} // 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);
|
parallel_for(BlockedRange(0, static_cast<int>(near_pairs.size())), body);
|
||||||
else
|
else
|
||||||
body(BlockedRange(0, static_cast<int>(near_pairs.size())));
|
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,
|
const vector<MatchesInfo> &pairwise_matches,
|
||||||
vector<CameraParams> &cameras)
|
vector<CameraParams> &cameras)
|
||||||
{
|
{
|
||||||
LOG("Bundle adjustment");
|
LOG_CHAT("Bundle adjustment");
|
||||||
int64 t = getTickCount();
|
int64 t = getTickCount();
|
||||||
|
|
||||||
num_images_ = static_cast<int>(features.size());
|
num_images_ = static_cast<int>(features.size());
|
||||||
@ -230,16 +230,16 @@ void BundleAdjusterBase::estimate(const vector<ImageFeatures> &features,
|
|||||||
if (_err)
|
if (_err)
|
||||||
{
|
{
|
||||||
calcError(err);
|
calcError(err);
|
||||||
LOG(".");
|
LOG_CHAT(".");
|
||||||
iter++;
|
iter++;
|
||||||
CvMat tmp = err;
|
CvMat tmp = err;
|
||||||
cvCopy(&tmp, _err);
|
cvCopy(&tmp, _err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGLN("");
|
LOGLN_CHAT("");
|
||||||
LOGLN("Bundle adjustment, final RMS error: " << sqrt(err.dot(err) / total_num_matches_));
|
LOGLN_CHAT("Bundle adjustment, final RMS error: " << sqrt(err.dot(err) / total_num_matches_));
|
||||||
LOGLN("Bundle adjustment, iterations done: " << iter);
|
LOGLN_CHAT("Bundle adjustment, iterations done: " << iter);
|
||||||
|
|
||||||
obtainRefinedCameraParams(cameras);
|
obtainRefinedCameraParams(cameras);
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ void BundleAdjusterBase::estimate(const vector<ImageFeatures> &features,
|
|||||||
for (int i = 0; i < num_images_; ++i)
|
for (int i = 0; i < num_images_; ++i)
|
||||||
cameras[i].R = R_inv * cameras[i].R;
|
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 detail
|
||||||
} // namespace cv
|
} // namespace cv
|
||||||
|
Loading…
x
Reference in New Issue
Block a user