summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-06-24 12:03:41 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-06-24 12:03:41 +0200
commit70832cc3b198998fa506211bd2d90f1a9c3e3458 (patch)
tree5798e1b8ec82ebea4e1fff87f51638b673c5a064
parent442fd797087834cb691cf18f4a808eee6d740353 (diff)
tracker/aruco: add experimental canny threshold ifdef
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.cpp8
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.h11
-rw-r--r--tracker-aruco/include/markerdetector.h1
3 files changed, 18 insertions, 2 deletions
diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp
index f2a2e3b8..171e3f26 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.cpp
+++ b/tracker-aruco/ftnoir_tracker_aruco.cpp
@@ -328,17 +328,23 @@ 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;
else
detector._thresMethod = aruco::MarkerDetector::ADPT_THRES;
+#else
+ detector._thresMethod = aruco::MarkerDetector::CANNY;
+#endif
}
void aruco_tracker::cycle_detection_params()
{
+#if !defined USE_EXPERIMENTAL_CANNY
if (!use_otsu)
use_otsu = true;
else
+#endif
{
use_otsu = false;
@@ -349,7 +355,9 @@ void aruco_tracker::cycle_detection_params()
set_detector_params();
qDebug() << "aruco: switched thresholding params"
+#if !defined USE_EXPERIMENTAL_CANNY
<< "otsu:" << use_otsu
+#endif
<< "size:" << adaptive_sizes[adaptive_size_pos];
}
diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h
index 8531bef9..4b3bde73 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.h
+++ b/tracker-aruco/ftnoir_tracker_aruco.h
@@ -31,6 +31,9 @@
// value 0->1
//#define DEBUG_UNSHARP_MASKING .75
+//canny thresholding
+//#define USE_EXPERIMENTAL_CANNY
+
using namespace options;
struct settings : opts {
@@ -127,11 +130,15 @@ private:
static constexpr const int adaptive_sizes[] =
{
+#if defined USE_EXPERIMENTAL_CANNY
+ 3,
+ 5,
+ 7,
+#else
7,
9,
- //11,
13,
- //5,
+#endif
};
static constexpr int adaptive_thres = 6;
diff --git a/tracker-aruco/include/markerdetector.h b/tracker-aruco/include/markerdetector.h
index 79a952a9..edcad976 100644
--- a/tracker-aruco/include/markerdetector.h
+++ b/tracker-aruco/include/markerdetector.h
@@ -278,6 +278,7 @@ private:
*/
void detectRectangles(const cv::Mat &thresImg,vector<MarkerCandidate> & candidates);
public:
+ std::vector<std::vector<cv::Point>> contours;
//Current threshold method
ThresholdMethods _thresMethod;
//Threshold parameters