diff options
author | Stéphane Lenclud <github@lenclud.com> | 2019-04-17 17:59:48 +0200 |
---|---|---|
committer | Stéphane Lenclud <github@lenclud.com> | 2019-04-24 18:46:12 +0200 |
commit | 0a85531e359dcde7aecdd486c6789cbeab93463f (patch) | |
tree | ddedceaa1fb0c167bc5e27f03e1ab93c1ee10faa /tracker-easy/point-extractor.cpp | |
parent | c4d9ad64f2aa9136c353dc4b10935dfca08a1779 (diff) |
Easy Tracker: Experimented with erode/dilate and mean/cam shift. It does not bring much.
Diffstat (limited to 'tracker-easy/point-extractor.cpp')
-rw-r--r-- | tracker-easy/point-extractor.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tracker-easy/point-extractor.cpp b/tracker-easy/point-extractor.cpp index cc58c70c..61175a57 100644 --- a/tracker-easy/point-extractor.cpp +++ b/tracker-easy/point-extractor.cpp @@ -17,9 +17,13 @@ #include <algorithm> #include <cinttypes> #include <memory> +#include <opencv2/highgui/highgui.hpp> +// Needed for mean shift +#include <opencv2/video/tracking.hpp> #include <QDebug> + using namespace numeric_types; namespace EasyTracker @@ -77,6 +81,16 @@ namespace EasyTracker return; } +//#define DEBUG +#ifdef DEBUG + cv::imshow("iFrameGray", iFrameGray); + cv::erode(iFrameGray, iFrameGray, cv::Mat(), cv::Point(-1, -1), 1); + cv::imshow("Eroded", iFrameGray); + cv::dilate(iFrameGray, iFrameGray, cv::Mat(), cv::Point(-1, -1), 2); + cv::imshow("Dilated", iFrameGray); +#endif + + // Contours detection iContours.clear(); cv::findContours(iFrameGray, iContours, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE); @@ -99,6 +113,9 @@ namespace EasyTracker && bBox.width <= s.max_point_size && bBox.height <= s.max_point_size) { + // Do a mean shift or cam shift, it's not bringing much though + //cv::CamShift(iFrameGray, bBox, cv::TermCriteria(cv::TermCriteria::EPS + cv::TermCriteria::MAX_ITER, 10, 1)); + // cv::Point center; center.x = bBox.x + bBox.width / 2; center.y = bBox.y + bBox.height / 2; |