summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.cpp29
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.h32
2 files changed, 21 insertions, 40 deletions
diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp
index 0c6f2b75..78be1623 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.cpp
+++ b/tracker-aruco/ftnoir_tracker_aruco.cpp
@@ -33,31 +33,7 @@
#include <algorithm>
#include <iterator>
-constexpr double aruco_tracker::timeout;
-constexpr double aruco_tracker::timeout_backoff_c;
-constexpr const int aruco_tracker::adaptive_sizes[];
-
-constexpr const aruco_tracker::resolution_tuple aruco_tracker::resolution_choices[];
-
-constexpr const double aruco_tracker::RC;
-constexpr const float aruco_tracker::size_min;
-constexpr const float aruco_tracker::size_max;
-
-#ifdef DEBUG_UNSHARP_MASKING
-constexpr double aruco_tracker::gauss_kernel_size;
-#endif
-
-aruco_tracker::aruco_tracker() :
- pose{0,0,0, 0,0,0},
- fps(0),
- no_detection_timeout(0),
- obj_points(4),
- intrinsics(cv::Matx33d::eye()),
- rmat(cv::Matx33d::eye()),
- roi_points(4),
- last_roi(65535, 65535, 0, 0),
- adaptive_size_pos(0),
- use_otsu(false)
+aruco_tracker::aruco_tracker()
{
cv::setBreakOnError(true);
// param 2 ignored for Otsu thresholding. it's required to use our fork of Aruco.
@@ -331,7 +307,6 @@ void aruco_tracker::set_roi_from_projection()
void aruco_tracker::set_detector_params()
{
detector.setDesiredSpeed(3);
- detector.setThresholdParams(adaptive_sizes[adaptive_size_pos], adaptive_thres);
#if !defined USE_EXPERIMENTAL_CANNY
if (use_otsu)
detector._thresMethod = aruco::MarkerDetector::FIXED_THRES;
@@ -487,7 +462,7 @@ aruco_dialog::aruco_dialog() :
connect(&calib_timer, SIGNAL(timeout()), this, SLOT(update_tracker_calibration()));
connect(ui.camera_settings, SIGNAL(clicked()), this, SLOT(camera_settings()));
- connect(&s.camera_name, SIGNAL(valueChanged(const QString&)), this, SLOT(update_camera_settings_state(const QString&)));
+ connect(&s.camera_name, base_value::value_changed<QString>(), this, &aruco_dialog::update_camera_settings_state);
update_camera_settings_state(s.camera_name);
}
diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h
index e41dfaa2..f25d3314 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.h
+++ b/tracker-aruco/ftnoir_tracker_aruco.h
@@ -101,27 +101,28 @@ private:
std::unique_ptr<cv_video_widget> videoWidget;
std::unique_ptr<QHBoxLayout> layout;
settings s;
- double pose[6], fps, no_detection_timeout;
+ double pose[6] {}, fps = 0;
+ 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;
- cv::Matx33d intrinsics;
+ std::vector<cv::Point3f> obj_points {4};
+ cv::Matx33d intrinsics = cv::Matx33d::eye();
aruco::MarkerDetector detector;
std::vector<aruco::Marker> markers;
cv::Vec3d t;
cv::Vec3d rvec, tvec;
std::vector<cv::Point2f> roi_projection;
std::vector<cv::Point2f> repr2;
- cv::Matx33d m_r, m_q, rmat;
+ cv::Matx33d m_r, m_q, rmat = cv::Matx33d::eye();
cv::Vec3d euler;
- std::vector<cv::Point3f> roi_points;
- cv::Rect last_roi;
+ 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;
- bool use_otsu;
+ unsigned adaptive_size_pos = 0;
+ bool use_otsu = false;
struct resolution_tuple
{
@@ -129,7 +130,7 @@ private:
int height;
};
- static constexpr const int adaptive_sizes[] =
+ static constexpr inline const int adaptive_sizes[] =
{
#if defined USE_EXPERIMENTAL_CANNY
3,
@@ -142,9 +143,13 @@ private:
#endif
};
- static constexpr int adaptive_thres = 6;
+#if !defined USE_EXPERIMENTAL_CANNY
+ static constexpr inline int adaptive_thres = 6;
+#else
+ static constexpr inline int adaptive_thres = 3;
+#endif
- static constexpr const resolution_tuple resolution_choices[] =
+ static constexpr inline const resolution_tuple resolution_choices[] =
{
{ 640, 480 },
{ 320, 240 },
@@ -152,10 +157,11 @@ private:
};
#ifdef DEBUG_UNSHARP_MASKING
- static constexpr double gauss_kernel_size = 3;
+ static constexpr inline double gauss_kernel_size = 3;
#endif
static constexpr inline double timeout = 1;
+
static constexpr inline double timeout_backoff_c = 4./11;
static constexpr inline float size_min = 0.05;
@@ -177,7 +183,7 @@ private:
settings s;
TranslationCalibrator calibrator;
QTimer calib_timer;
-private slots:
+private Q_SLOTS:
void doOK();
void doCancel();
void toggleCalibrate();