summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ftnoir_tracker_pt/ftnoir_tracker_pt.cpp')
-rwxr-xr-x[-rw-r--r--]ftnoir_tracker_pt/ftnoir_tracker_pt.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp
index e10cfea0..4fa70ccf 100644..100755
--- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp
+++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp
@@ -57,8 +57,9 @@ bool Tracker_PT::get_focal_length(float& ret)
{
static constexpr double pi = 3.14159265359;
const int w = info.res_x, h = info.res_y;
- const double diag = sqrt(w * w + h * h)/w, diag_fov = static_cast<int>(s.fov) * pi / 180.;
- const double fov = 2.*atan(tan(diag_fov/2.0)/sqrt(1. + diag*diag));
+ const double diag = sqrt(1. + h/(double)w * h/(double)w);
+ const double diag_fov = static_cast<int>(s.fov) * pi / 180.;
+ const double fov = 2.*atan(tan(diag_fov/2.0)/diag);
ret = .5 / tan(.5 * fov);
return true;
}