From 5ebbcda77e2ad01932be9573a63242f4164fdbb8 Mon Sep 17 00:00:00 2001 From: Stéphane Lenclud Date: Sun, 14 Apr 2019 23:21:08 +0200 Subject: Easy Tracker: Removed area check from bounding box validation. Using simpler contours. --- tracker-easy/point-extractor.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tracker-easy/point-extractor.cpp b/tracker-easy/point-extractor.cpp index d8ea3c53..037d06c0 100644 --- a/tracker-easy/point-extractor.cpp +++ b/tracker-easy/point-extractor.cpp @@ -80,7 +80,7 @@ namespace EasyTracker // Contours detection std::vector > contours; - cv::findContours(iFrameGray, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE); + cv::findContours(iFrameGray, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE); // Workout which countours are valid points for (size_t i = 0; i < contours.size(); i++) @@ -93,22 +93,12 @@ namespace EasyTracker cv::Rect bBox; bBox = cv::boundingRect(contours[i]); - - float ratio = (float)bBox.width / (float)bBox.height; - if (ratio > 1.0f) - ratio = 1.0f / ratio; - - // Searching for a bBox almost square - float minArea = s.min_point_size*s.min_point_size; - float maxArea = s.max_point_size*s.max_point_size; + // Make sure bounding box matches our criteria if (bBox.width >= s.min_point_size && bBox.height >= s.min_point_size && bBox.width <= s.max_point_size - && bBox.height <= s.max_point_size - && bBox.area() >= minArea - && bBox.area() <= maxArea - /*&& ratio > 0.75 &&*/) + && bBox.height <= s.max_point_size) { vec2 center; center[0] = bBox.x + bBox.width / 2; -- cgit v1.2.3