diff options
author | Stéphane Lenclud <github@lenclud.com> | 2019-04-01 20:31:10 +0200 |
---|---|---|
committer | Stéphane Lenclud <github@lenclud.com> | 2019-04-24 18:46:12 +0200 |
commit | c029e52a330842415502cc29a3460e016d4a8a93 (patch) | |
tree | 400a12e1fbfc5b0a28b36915f00513fab12ac75a /tracker-points/pt-api.cpp | |
parent | 456a922b5995f1f836c13c5795258bc83e521571 (diff) |
Renaming Points Tracker to Easy Tracker.
Diffstat (limited to 'tracker-points/pt-api.cpp')
-rw-r--r-- | tracker-points/pt-api.cpp | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/tracker-points/pt-api.cpp b/tracker-points/pt-api.cpp deleted file mode 100644 index f64d5c9a..00000000 --- a/tracker-points/pt-api.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "pt-api.hpp" -#include "cv/numeric.hpp" - -using namespace numeric_types; - -pt_camera_info::pt_camera_info() = default; - -f pt_camera_info::get_focal_length(f fov, int res_x, int res_y) -{ - const f diag_len = std::sqrt(f(res_x*res_x + res_y*res_y)); - const f aspect_x = res_x / diag_len; - //const double aspect_y = res_y / diag_len; - const f diag_fov = fov * pi/180; - const f fov_x = 2*std::atan(std::tan(diag_fov*f{.5}) * aspect_x); - //const double fov_y = 2*atan(tan(diag_fov*.5) * aspect_y); - const f fx = f{.5} / std::tan(fov_x * f{.5}); - return fx; - //fy = .5 / tan(fov_y * .5); - //static bool once = false; if (!once) { once = true; qDebug() << "f" << ret << "fov" << (fov * 180/M_PI); } -} - -pt_camera::pt_camera() = default; -pt_camera::~pt_camera() = default; -pt_runtime_traits::pt_runtime_traits() = default; -pt_runtime_traits::~pt_runtime_traits() = default; -pt_point_extractor::pt_point_extractor() = default; -pt_point_extractor::~pt_point_extractor() = default; - -f pt_point_extractor::threshold_radius_value(int w, int h, int threshold) -{ - f cx = w / f{640}, cy = h / f{480}; - - const f min_radius = f{1.75} * cx; - const f max_radius = f{15} * cy; - - const f radius = std::fmax(f{0}, (max_radius-min_radius) * threshold / f(255) + min_radius); - - return radius; -} - -std::tuple<f, f> pt_pixel_pos_mixin::to_pixel_pos(f x, f y, int w, int h) -{ - return std::make_tuple(w*(x+f{.5}), f{.5}*(h - 2*y*w)); -} - -std::tuple<f, f> pt_pixel_pos_mixin::to_screen_pos(f px, f py, int w, int h) -{ - px *= w/(w-f{1}); py *= h/(h-f{1}); - return std::make_tuple((px - w/f{2})/w, -(py - h/f{2})/w); -} - -pt_frame::pt_frame() = default; - -pt_frame::~pt_frame() = default; |