summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tracker-aruco/aruco-trackercontrols.ui115
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.cpp34
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.h50
3 files changed, 73 insertions, 126 deletions
diff --git a/tracker-aruco/aruco-trackercontrols.ui b/tracker-aruco/aruco-trackercontrols.ui
index 0d70d9ed..a1600a8f 100644
--- a/tracker-aruco/aruco-trackercontrols.ui
+++ b/tracker-aruco/aruco-trackercontrols.ui
@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>453</width>
- <height>246</height>
+ <width>462</width>
+ <height>221</height>
</rect>
</property>
<property name="windowTitle">
@@ -64,21 +64,33 @@
<item>
<widget class="QFrame" name="frame">
<layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Diagonal FOV</string>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="cameraName">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
</widget>
</item>
- <item row="2" column="1">
- <widget class="QComboBox" name="cameraName">
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="cameraFOV">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="minimum">
+ <number>35</number>
+ </property>
+ <property name="maximum">
+ <number>90</number>
+ </property>
</widget>
</item>
<item row="3" column="1">
@@ -106,6 +118,34 @@
</item>
</widget>
</item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_12">
+ <property name="text">
+ <string>Frames per second</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>Resolution</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_10">
+ <property name="text">
+ <string>Camera name</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Diagonal FOV</string>
+ </property>
+ </widget>
+ </item>
<item row="1" column="1">
<widget class="QComboBox" name="cameraFPS">
<property name="sizePolicy">
@@ -146,47 +186,7 @@
</item>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QSpinBox" name="cameraFOV">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="locale">
- <locale language="English" country="UnitedStates"/>
- </property>
- <property name="minimum">
- <number>35</number>
- </property>
- <property name="maximum">
- <number>90</number>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_10">
- <property name="text">
- <string>Camera name</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_12">
- <property name="text">
- <string>Frames per second</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_11">
- <property name="text">
- <string>Resolution</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
+ <item row="4" column="1">
<widget class="QPushButton" name="camera_settings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@@ -199,23 +199,6 @@
</property>
</widget>
</item>
- <item row="4" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Model rotation</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QComboBox" name="model_rotation">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
</layout>
</widget>
</item>
diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp
index faa8bb44..5ce52565 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.cpp
+++ b/tracker-aruco/ftnoir_tracker_aruco.cpp
@@ -227,19 +227,6 @@ void aruco_tracker::clamp_last_roi()
last_roi &= cv::Rect(0, 0, color.cols, color.rows);
}
-cv::Point3f aruco_tracker::rotate_model(float x, float y, settings::rot mode)
-{
- cv::Point3f pt(x, y, 0);
-
- if (mode)
- {
- const double theta = int(mode) * 90/4. * M_PI/180;
- pt.x = x * cos(theta) - y * sin(theta);
- pt.y = y * cos(theta) + x * sin(theta);
- }
- return pt;
-}
-
void aruco_tracker::set_points()
{
using f = float;
@@ -249,12 +236,10 @@ void aruco_tracker::set_points()
const int x1=1, x2=2, x3=3, x4=0;
- settings::rot mode = s.model_rotation;
-
- obj_points[x1] = rotate_model(-size, -size, mode);
- obj_points[x2] = rotate_model(size, -size, mode);
- obj_points[x3] = rotate_model(size, size, mode);
- obj_points[x4] = rotate_model(-size, size, mode);
+ obj_points[x1] = { -size, -size, 0 };
+ obj_points[x2] = { size, -size, 0 };
+ obj_points[x3] = { size, size, 0 };
+ obj_points[x4] = { -size, size, 0 };
for (unsigned i = 0; i < 4; i++)
obj_points[i] += cv::Point3f(hx, hy, hz);
@@ -341,9 +326,9 @@ void aruco_tracker::set_detector_params()
detector.setThresholdParams(adaptive_sizes[adaptive_size_pos], adaptive_thres);
#else
- detector._thresMethod = aruco::MarkerDetector::CANNY;
- int value = adaptive_sizes[adaptive_size_pos];
- detector.setThresholdParams(value, value * 3);
+ detector._thresMethod = aruco::MarkerDetector::CANNY;
+ int value = adaptive_sizes[adaptive_size_pos];
+ detector.setThresholdParams(value, value * 3);
#endif
}
@@ -480,11 +465,6 @@ aruco_dialog::aruco_dialog() :
tie_setting(s.headpos_y, ui.cy);
tie_setting(s.headpos_z, ui.cz);
- ui.model_rotation->addItem("0", int(settings::rot_zero));
- ui.model_rotation->addItem("+22.5", int(settings::rot_plus));
- ui.model_rotation->addItem("-22.5", int(settings::rot_neg));
- tie_setting(s.model_rotation, ui.model_rotation);
-
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK()));
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
connect(ui.btn_calibrate, SIGNAL(clicked()), this, SLOT(toggleCalibrate()));
diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h
index 293991eb..b634576a 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.h
+++ b/tracker-aruco/ftnoir_tracker_aruco.h
@@ -38,29 +38,17 @@
using namespace options;
struct settings : opts {
- enum rot
- {
- rot_zero = 0,
- rot_neg = -1,
- rot_plus = +1,
- };
-
- value<int> fov;
- value<double> headpos_x, headpos_y, headpos_z;
- value<QString> camera_name;
- value<int> force_fps, resolution;
- value<rot> model_rotation;
- settings() :
- opts("aruco-tracker"),
- fov(b, "field-of-view", 56),
- headpos_x(b, "headpos-x", 0),
- headpos_y(b, "headpos-y", 0),
- headpos_z(b, "headpos-z", 0),
- camera_name(b, "camera-name", ""),
- force_fps(b, "force-fps", 0),
- resolution(b, "force-resolution", 0),
- model_rotation(b, "model-rotation", rot_zero)
- {}
+ value<QString> camera_name { b, "camera-name", ""};
+ value<int> fov { b, "field-of-view", 56 };
+
+ value<double> headpos_x { b, "headpos-x", 0 },
+ headpos_y { b, "headpos-y", 0 },
+ headpos_z { b, "headpos-z", 0 };
+
+ value<int> force_fps { b, "force-fps", 0 },
+ resolution { b, "force-resolution", 0 };
+
+ settings() = default;
};
class aruco_dialog;
@@ -93,8 +81,6 @@ private:
void set_detector_params();
void cycle_detection_params();
- cv::Point3f rotate_model(float x, float y, settings::rot mode);
-
cv::VideoCapture camera;
QMutex camera_mtx;
QMutex mtx;
@@ -105,9 +91,6 @@ private:
double no_detection_timeout = 0;
cv::Mat frame, grayscale, color;
cv::Matx33d r;
-#ifdef DEBUG_UNSHARP_MASKING
- cv::Mat blurred;
-#endif
std::vector<cv::Point3f> obj_points {4};
cv::Matx33d intrinsics = cv::Matx33d::eye();
aruco::MarkerDetector detector;
@@ -121,7 +104,7 @@ private:
std::vector<cv::Point3f> roi_points {4};
cv::Rect last_roi { 65535, 65535, 0, 0 };
Timer fps_timer, last_detection_timer;
- unsigned adaptive_size_pos = 0;
+ unsigned adaptive_size_pos { 0 };
bool use_otsu = false;
#if !defined USE_EXPERIMENTAL_CANNY
@@ -130,10 +113,6 @@ private:
static constexpr inline int adaptive_thres = 3;
#endif
-#ifdef DEBUG_UNSHARP_MASKING
- static constexpr inline double gauss_kernel_size = 3;
-#endif
-
static constexpr inline double timeout = 1;
static constexpr inline double timeout_backoff_c = 4./11;
@@ -141,6 +120,11 @@ private:
static constexpr inline float size_max = 0.5;
static constexpr inline double RC = .25;
+
+#ifdef DEBUG_UNSHARP_MASKING
+ static constexpr inline double gauss_kernel_size = 3;
+ cv::Mat blurred;
+#endif
};
class aruco_dialog : public ITrackerDialog