From a04514b37901939662f352b7c784b6003c9dc5c6 Mon Sep 17 00:00:00 2001 From: Stéphane Lenclud Date: Tue, 16 Apr 2019 18:19:36 +0200 Subject: Easy Tracker: Moving things around and theoretical data structure usage optimization. --- tracker-easy/point-extractor.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tracker-easy/point-extractor.cpp') diff --git a/tracker-easy/point-extractor.cpp b/tracker-easy/point-extractor.cpp index c1f525c9..cc58c70c 100644 --- a/tracker-easy/point-extractor.cpp +++ b/tracker-easy/point-extractor.cpp @@ -78,20 +78,20 @@ namespace EasyTracker } // Contours detection - std::vector > contours; - cv::findContours(iFrameGray, contours, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE); + iContours.clear(); + cv::findContours(iFrameGray, iContours, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE); // Workout which countours are valid points - for (size_t i = 0; i < contours.size(); i++) + for (size_t i = 0; i < iContours.size(); i++) { if (aPreview) { - cv::drawContours(*aPreview, contours, (int)i, CV_RGB(255, 0, 0), 2); + cv::drawContours(*aPreview, iContours, (int)i, CV_RGB(255, 0, 0), 2); } cv::Rect bBox; - bBox = cv::boundingRect(contours[i]); + bBox = cv::boundingRect(iContours[i]); // Make sure bounding box matches our criteria if (bBox.width >= s.min_point_size @@ -116,7 +116,7 @@ namespace EasyTracker // Typically noise comming from zippers and metal parts on your clothing. // With a cap tracker it also successfully discards noise from glasses. // However it may not work as good with a clip user wearing glasses. - while (aPoints.size() > 3) // Until we have no more than three points + while (aPoints.size() > KPointCount) // Until we have no more than three points { int maxY = 0; size_t index = -1; -- cgit v1.2.3