summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStéphane Lenclud <github@lenclud.com>2019-04-14 23:21:08 +0200
committerStéphane Lenclud <github@lenclud.com>2019-04-24 18:46:12 +0200
commit5ebbcda77e2ad01932be9573a63242f4164fdbb8 (patch)
treeb2b106b1bd383e5c7e13540ad279a5dc195b333a
parent69a16a5bb45eafe185fa708f572788908ce9ebff (diff)
Easy Tracker: Removed area check from bounding box validation. Using simpler contours.
-rw-r--r--tracker-easy/point-extractor.cpp16
1 files 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<std::vector<cv::Point> > 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;