summaryrefslogtreecommitdiffhomepage
path: root/opentrack
diff options
context:
space:
mode:
Diffstat (limited to 'opentrack')
-rw-r--r--opentrack/camera-names.hpp8
-rw-r--r--opentrack/main-settings.hpp8
-rw-r--r--opentrack/opencv-calibration.hpp50
-rw-r--r--opentrack/opencv-camera-dialog.hpp8
-rw-r--r--opentrack/plugin-api.hpp8
-rw-r--r--opentrack/shortcuts.cpp9
-rw-r--r--opentrack/tracker.cpp2
7 files changed, 75 insertions, 18 deletions
diff --git a/opentrack/camera-names.hpp b/opentrack/camera-names.hpp
index fd869e6b..4ae07a9f 100644
--- a/opentrack/camera-names.hpp
+++ b/opentrack/camera-names.hpp
@@ -1,3 +1,11 @@
+/* Copyright (c) 2014-2015, Stanislaw Halik <sthalik@misaki.pl>
+
+ * Permission to use, copy, modify, and/or distribute this
+ * software for any purpose with or without fee is hereby granted,
+ * provided that the above copyright notice and this permission
+ * notice appear in all copies.
+ */
+
#pragma once
#include <QList>
diff --git a/opentrack/main-settings.hpp b/opentrack/main-settings.hpp
index d3a49a83..300c0561 100644
--- a/opentrack/main-settings.hpp
+++ b/opentrack/main-settings.hpp
@@ -1,3 +1,11 @@
+/* Copyright (c) 2015, Stanislaw Halik <sthalik@misaki.pl>
+
+ * Permission to use, copy, modify, and/or distribute this
+ * software for any purpose with or without fee is hereby granted,
+ * provided that the above copyright notice and this permission
+ * notice appear in all copies.
+ */
+
#pragma once
#include <QString>
diff --git a/opentrack/opencv-calibration.hpp b/opentrack/opencv-calibration.hpp
index 6dee9908..99e6d4c7 100644
--- a/opentrack/opencv-calibration.hpp
+++ b/opentrack/opencv-calibration.hpp
@@ -1,3 +1,11 @@
+/* Copyright (c) 2015, Stanislaw Halik <sthalik@misaki.pl>
+
+ * Permission to use, copy, modify, and/or distribute this
+ * software for any purpose with or without fee is hereby granted,
+ * provided that the above copyright notice and this permission
+ * notice appear in all copies.
+ */
+
#pragma once
#include <QCoreApplication>
#include <QString>
@@ -6,21 +14,31 @@
#include <opencv2/core.hpp>
template<typename = void>
-bool get_camera_calibration(const QString& camera_name, cv::Mat& intrinsics, cv::Mat& distortion, int w, int h)
+bool get_camera_calibration(const QString& camera_name, cv::Mat& intrinsics, cv::Mat& distortion, int w, int h, int fov)
{
- QString pathname_ = QCoreApplication::applicationDirPath() + "/camera/" + camera_name + ".yml";
- std::string pathname = pathname_.toStdString();
- cv::FileStorage fs(pathname, cv::FileStorage::READ);
- if (!fs.isOpened())
- return false;
- cv::Mat intrinsics_, distortion_;
- fs["camera_matrix"] >> intrinsics_;
- fs["distortion_coefficients"] >> distortion_;
- intrinsics_.at<double>(0, 0) *= w / 640.;
- intrinsics_.at<double>(2, 0) *= w / 640.;
- intrinsics_.at<double>(1, 1) *= h / 480.;
- intrinsics_.at<double>(2, 1) *= h / 480.;
- intrinsics = intrinsics_;
- distortion = distortion_;
- return true;
+ const QString pathnames[] = {
+ QCoreApplication::applicationDirPath() + "/camera/" + camera_name + "-" + QString::number(fov) + ".yml",
+ QCoreApplication::applicationDirPath() + "/camera/" + camera_name + ".yml",
+ };
+ for (auto& pathname : pathnames)
+ {
+ cv::FileStorage fs(pathname.toStdString(), cv::FileStorage::READ);
+ if (!fs.isOpened())
+ continue;
+ cv::Mat intrinsics_, distortion_;
+ fs["camera_matrix"] >> intrinsics_;
+ fs["distortion_coefficients"] >> distortion_;
+ int w_, h_;
+ fs["image_width"] >> w_;
+ fs["image_height"] >> h_;
+ double w__ = w_, h__ = h_;
+ intrinsics_.at<float>(0, 0) *= w / w__;
+ intrinsics_.at<float>(2, 0) *= w / w__;
+ intrinsics_.at<float>(1, 1) *= h / h__;
+ intrinsics_.at<float>(2, 1) *= h / h__;
+ intrinsics = intrinsics_;
+ distortion = distortion_;
+ return true;
+ }
+ return false;
}
diff --git a/opentrack/opencv-camera-dialog.hpp b/opentrack/opencv-camera-dialog.hpp
index cd3d38e7..0d4a51af 100644
--- a/opentrack/opencv-camera-dialog.hpp
+++ b/opentrack/opencv-camera-dialog.hpp
@@ -1,3 +1,11 @@
+/* Copyright (c) 2015, Stanislaw Halik <sthalik@misaki.pl>
+
+ * Permission to use, copy, modify, and/or distribute this
+ * software for any purpose with or without fee is hereby granted,
+ * provided that the above copyright notice and this permission
+ * notice appear in all copies.
+ */
+
#pragma once
#include <QTimer>
diff --git a/opentrack/plugin-api.hpp b/opentrack/plugin-api.hpp
index 021f5017..b0da4950 100644
--- a/opentrack/plugin-api.hpp
+++ b/opentrack/plugin-api.hpp
@@ -1,3 +1,11 @@
+/* Copyright (c) 2013-2015, Stanislaw Halik <sthalik@misaki.pl>
+
+ * Permission to use, copy, modify, and/or distribute this
+ * software for any purpose with or without fee is hereby granted,
+ * provided that the above copyright notice and this permission
+ * notice appear in all copies.
+ */
+
#pragma once
#include "export.hpp"
diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp
index e81b6bb0..ed1701c7 100644
--- a/opentrack/shortcuts.cpp
+++ b/opentrack/shortcuts.cpp
@@ -1,7 +1,14 @@
+/* Copyright (c) 2014, Stanislaw Halik <sthalik@misaki.pl>
+
+ * Permission to use, copy, modify, and/or distribute this
+ * software for any purpose with or without fee is hereby granted,
+ * provided that the above copyright notice and this permission
+ * notice appear in all copies.
+ */
+
#include "shortcuts.h"
#include <QMutexLocker>
-
#if defined(_WIN32)
#include <windows.h>
diff --git a/opentrack/tracker.cpp b/opentrack/tracker.cpp
index ce23afad..e9d85f5d 100644
--- a/opentrack/tracker.cpp
+++ b/opentrack/tracker.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2013 Stanislaw Halik <sthalik@misaki.pl>
+/* Copyright (c) 2012-2015 Stanislaw Halik <sthalik@misaki.pl>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above