summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_pt
diff options
context:
space:
mode:
Diffstat (limited to 'ftnoir_tracker_pt')
-rw-r--r--ftnoir_tracker_pt/FTNoIR_PT_Controls.ui2
-rw-r--r--ftnoir_tracker_pt/ftnoir_tracker_pt.cpp9
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()