From e3cdf48fa74086baf6e7cc772339f14d6af094fd Mon Sep 17 00:00:00 2001 From: Walter Perdan Date: Sun, 3 Mar 2024 17:33:54 +0100 Subject: [PATCH] small improves - raise min. num. of matches to 8 --- .../WebARKitTrackers/WebARKitOpticalTracking/WebARKitConfig.cpp | 2 +- .../WebARKitOpticalTracking/WebARKitTracker.cpp | 1 + .../WebARKitTrackers/WebARKitOpticalTracking/WebARKitUtils.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/WebARKitConfig.cpp b/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/WebARKitConfig.cpp index 9727faf..89539e9 100644 --- a/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/WebARKitConfig.cpp +++ b/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/WebARKitConfig.cpp @@ -5,7 +5,7 @@ extern const double TEBLID_NN_MATCH_RATIO = 0.8f; extern const int DEFAULT_MAX_FEATURES = 8000; extern const int TEBLID_MAX_FEATURES = 10000; extern const int N = 10; -extern const int MIN_NUM_MATCHES = 50; +extern const int MIN_NUM_MATCHES = 8; extern const int maxLevel = 3; ///< Maximum number of levels in optical flow image pyramid. extern const cv::Size winSize(31, 31); extern const cv::TermCriteria termcrit(cv::TermCriteria::COUNT | cv::TermCriteria::EPS, 20, 0.03); diff --git a/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/WebARKitTracker.cpp b/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/WebARKitTracker.cpp index 5bee56e..7dd5b23 100644 --- a/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/WebARKitTracker.cpp +++ b/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/WebARKitTracker.cpp @@ -25,6 +25,7 @@ class WebARKitTracker::WebARKitTrackerImpl { _nn_match_ratio = DEFAULT_NN_MATCH_RATIO; minNumMatches = 15; } + WEBARKIT_LOGi("Min Num Matches: %d\n", minNumMatches); _camera->setupCamera(frameWidth, frameHeight); _camera->printSettings(); diff --git a/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/include/WebARKitTrackers/WebARKitOpticalTracking/WebARKitUtils.h b/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/include/WebARKitTrackers/WebARKitOpticalTracking/WebARKitUtils.h index 2a8c450..5295852 100644 --- a/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/include/WebARKitTrackers/WebARKitOpticalTracking/WebARKitUtils.h +++ b/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/include/WebARKitTrackers/WebARKitOpticalTracking/WebARKitUtils.h @@ -28,7 +28,7 @@ namespace webarkit { return cv::Mat(rows, cols, CV_8UC1, gray); }*/ -static auto convert2Grayscale(cv::Mat refData, size_t refCols, size_t refRows, ColorSpace colorSpace) { +static auto convert2Grayscale(cv::Mat& refData, size_t refCols, size_t refRows, ColorSpace colorSpace) { cv::Mat refGray; switch (colorSpace) {