From 20a8ecf5e4549440d998b6db5a29a6e8731223ce Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 10 Oct 2016 11:35:30 +0200 Subject: tracker/pt: change focal length formula It looks kind of funky. At the moment it gives me correct Z (with a ruler) given right FOV. Though the pitch value is still skewed given lack of perspective transform for Y pixel value in extractor. --- tracker-pt/ftnoir_tracker_pt.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index ce19d592..2a13e3c6 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -68,10 +68,10 @@ bool Tracker_PT::get_focal_length(f& ret) using std::atan; using std::sqrt; - const int w = info.res_x, h = info.res_y; - const double diag = sqrt(1. + h/(double)w * h/(double)w); + const double w = info.res_x, h = info.res_y; + const double diag = sqrt(w/h*w/h + h/w*h/w); const double diag_fov = static_cast(s.fov) * M_PI / 180.; - const double fov = 2.*atan(tan(diag_fov/2.0)/diag); + const double fov = 2.*atan(tan(diag_fov/2.)/diag); ret = .5 / tan(.5 * fov); return true; } -- cgit v1.2.3