diff options
Diffstat (limited to 'tracker-pt')
-rw-r--r-- | tracker-pt/camera.cpp | 5 | ||||
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt.cpp | 7 | ||||
-rw-r--r-- | tracker-pt/point_extractor.cpp | 19 | ||||
-rw-r--r-- | tracker-pt/point_tracker.cpp | 7 |
4 files changed, 10 insertions, 28 deletions
diff --git a/tracker-pt/camera.cpp b/tracker-pt/camera.cpp index b68fd107..28c95bf4 100644 --- a/tracker-pt/camera.cpp +++ b/tracker-pt/camera.cpp @@ -8,6 +8,7 @@ #include "camera.h" #include "compat/sleep.hpp" #include "compat/camera-names.hpp" +#include "compat/math-imports.hpp" constexpr double Camera::dt_eps; @@ -23,10 +24,6 @@ QString Camera::get_active_name() const void CamInfo::get_focal_length(double& fx) const { - using std::tan; - using std::atan; - using std::sqrt; - const double diag_len = sqrt(double(res_x*res_x + res_y*res_y)); const double aspect_x = res_x / diag_len; //const double aspect_y = res_y / diag_len; diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index 938acc1c..83ea094c 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -8,6 +8,7 @@ #include "ftnoir_tracker_pt.h" #include "compat/camera-names.hpp" +#include "compat/math-imports.hpp" #include <QHBoxLayout> #include <cmath> #include <QDebug> @@ -190,12 +191,6 @@ void Tracker_PT::data(double *data) 0, 1, 0); mat33 R = R_EG * X_GH.R * R_EG.t(); - using std::atan2; - using std::sqrt; - using std::atan; - using std::fabs; - using std::copysign; - // get translation(s) const vec3& t = X_GH.t; diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp index fbd84799..babba294 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -8,6 +8,7 @@ #include "point_extractor.h" #include "compat/util.hpp" +#include "compat/math-imports.hpp" #include "point_tracker.h" #include <QDebug> @@ -20,10 +21,6 @@ #include <vector> #include <array> -using std::sqrt; -using std::fmax; -using std::min; - using namespace pt_extractor_impl; /* @@ -51,7 +48,7 @@ static cv::Vec2d MeanShiftIteration(const cv::Mat &frame_gray, const vec2 &curre vec2 com(0, 0); for (int i = 0; i < frame_gray.rows; i++) { - const auto frame_ptr = (const std::uint8_t*)frame_gray.ptr(i); + const auto frame_ptr = (const uint8_t*)frame_gray.ptr(i); for (int j = 0; j < frame_gray.cols; j++) { f val = frame_ptr[j]; @@ -145,7 +142,7 @@ void PointExtractor::extract_points(const cv::Mat& frame, cv::Mat& preview_frame contours.clear(); cv::findContours(frame_bin, contours, cv::RETR_LIST, cv::CHAIN_APPROX_SIMPLE); - const unsigned cnt = std::min<unsigned>(max_blobs, contours.size()); + const unsigned cnt = min(max_blobs, int(contours.size())); for (unsigned k = 0; k < cnt; k++) { @@ -155,14 +152,12 @@ void PointExtractor::extract_points(const cv::Mat& frame, cv::Mat& preview_frame cv::Moments moments = cv::moments(contours[k]); const double area = moments.m00; - const double radius = std::sqrt(area) / std::sqrt(M_PI); + const double radius = sqrt(area) / sqrt(M_PI); - if (radius < std::fmax(2.5, region_size_min) || (radius > region_size_max)) + if (radius < fmax(2.5, region_size_min) || (radius > region_size_max)) continue; - cv::Rect rect = cv::boundingRect(contours[k]) & cv::Rect(0, 0, frame.cols, frame.rows); - - rect &= cv::Rect(0, 0, frame.cols, frame.rows); // crop at frame boundaries + const cv::Rect rect = cv::boundingRect(contours[k]) & cv::Rect(0, 0, frame.cols, frame.rows); if (rect.width == 0 || rect.height == 0) continue; @@ -240,7 +235,7 @@ void PointExtractor::extract_points(const cv::Mat& frame, cv::Mat& preview_frame } #if defined DEBUG_MEANSHIFT - meanshift_total += std::sqrt((pos_ - pos).dot(pos_ - pos)); + meanshift_total += sqrt((pos_ - pos).dot(pos_ - pos)); #endif b.pos[0] = pos[0] + rect.x; diff --git a/tracker-pt/point_tracker.cpp b/tracker-pt/point_tracker.cpp index 73745d8f..dfc7a8a5 100644 --- a/tracker-pt/point_tracker.cpp +++ b/tracker-pt/point_tracker.cpp @@ -7,6 +7,7 @@ #include "point_tracker.h" #include "compat/nan.hpp" +#include "compat/math-imports.hpp" using namespace types; @@ -280,12 +281,6 @@ int PointTracker::POSIT(const PointModel& model, const PointOrder& order, f foca static constexpr int max_iter = 100; - using std::sqrt; - using std::atan; - using std::cos; - using std::sin; - using std::fabs; - int i=1; for (; i<max_iter; ++i) { |