diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-14 09:31:59 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-14 09:31:59 +0200 |
commit | a6b13be4729dd212f0b182aa238f9004ef830388 (patch) | |
tree | ef4dd114245e732e2230a89d4be92d9d74dfc8f9 /ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | |
parent | c986731a379191e096a965f4d741bc3853820b8f (diff) | |
parent | ec054c285c22ef1ff54841adb25f2d5abe41bdcb (diff) |
Merge branch 'unstable' into trackhat-ui
Diffstat (limited to 'ftnoir_tracker_pt/ftnoir_tracker_pt.cpp')
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index d48f9252..d3cf18c1 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -54,7 +54,7 @@ void Tracker_PT::reset_command(Command command) float Tracker_PT::get_focal_length() { - static constexpr float pi = 3.1415926f; + static constexpr float pi = 3.1415926; float fov_; switch (s.fov) { @@ -67,8 +67,12 @@ float Tracker_PT::get_focal_length() break; } - const float fov = static_cast<int>(fov_) * pi / 180.f; - return 0.5f / tan(0.5f * fov); + const float diag_fov = static_cast<int>(fov_) * pi / 180.f; + CamInfo info = camera.get_info(); + const int w = info.res_x, h = info.res_y; + const double diag = sqrt(w * w + h * h)/w; + const double fov = 2.*atan(tan(diag_fov/2.0)/sqrt(1. + diag*diag)); + return .5 / tan(.5 * fov); } void Tracker_PT::run() |