diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-10-10 11:35:30 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-10-10 11:35:30 +0200 |
commit | 20a8ecf5e4549440d998b6db5a29a6e8731223ce (patch) | |
tree | 2be381a87506f4c357f0cebc9dbb41ce3ccd8045 | |
parent | 73a03e22bbadf0bfc12174ce3859773494258e56 (diff) |
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.
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt.cpp | 6 |
1 files 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<int>(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; } |