diff options
author | Stéphane Lenclud <github@lenclud.com> | 2019-04-16 18:19:36 +0200 |
---|---|---|
committer | Stéphane Lenclud <github@lenclud.com> | 2019-04-24 18:46:12 +0200 |
commit | c4d9ad64f2aa9136c353dc4b10935dfca08a1779 (patch) | |
tree | 1363c30dadbc1e74610464b64b7667eb94ff711e /tracker-easy/point-extractor.cpp | |
parent | be51a114bca4f3f43ed88001cdc510ccf246079f (diff) |
Easy Tracker: Moving things around and theoretical data structure usage optimization.
Diffstat (limited to 'tracker-easy/point-extractor.cpp')
-rw-r--r-- | tracker-easy/point-extractor.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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<std::vector<cv::Point> > 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; |