diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-13 19:04:59 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-13 19:04:59 +0200 |
commit | 513d3d0f71670493f8cb95eda80ad55e041680df (patch) | |
tree | 148fcaf60ae34745b33d3292032af1b13aeee374 /ftnoir_tracker_pt | |
parent | 279d6c1b0534edd7c49f2f1fbf56acf9ed1c4a21 (diff) |
pt, ht, aruco: use calibration data. rename fov to diagonal in UI
Diffstat (limited to 'ftnoir_tracker_pt')
-rw-r--r-- | ftnoir_tracker_pt/FTNoIR_PT_Controls.ui | 2 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui index 3e900e8e..928b1374 100644 --- a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui +++ b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui @@ -114,7 +114,7 @@ </sizepolicy> </property> <property name="text"> - <string>Field of view</string> + <string>Diagonal field of view</string> </property> </widget> </item> diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index dc0659e5..5b9ec8b6 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -54,9 +54,12 @@ void Tracker_PT::reset_command(Command command) float Tracker_PT::get_focal_length() { - static constexpr float pi = 3.1415926f; - const float fov = static_cast<int>(s.fov) * pi / 180.f; - return 0.5f / tan(0.5f * fov); + CamInfo info = camera.get_info(); + const int w = info.res_x, h = info.res_y; + static constexpr double pi = 3.1415926f; + 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)); + return .5 / tan(.5 * fov); } void Tracker_PT::run() |