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 | |
| parent | c4d9ad64f2aa9136c353dc4b10935dfca08a1779 (diff) | |
Easy Tracker: Experimented with erode/dilate and mean/cam shift. It does not bring much.
| -rw-r--r-- | tracker-easy/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | tracker-easy/point-extractor.cpp | 17 | 
2 files changed, 18 insertions, 1 deletions
| diff --git a/tracker-easy/CMakeLists.txt b/tracker-easy/CMakeLists.txt index 229a90ae..7b776c9b 100644 --- a/tracker-easy/CMakeLists.txt +++ b/tracker-easy/CMakeLists.txt @@ -2,5 +2,5 @@ find_package(OpenCV QUIET)  if(OpenCV_FOUND)      otr_module(tracker-easy)      target_include_directories(${self} SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) -    target_link_libraries(${self} opencv_imgproc opencv_calib3d opentrack-cv opencv_core opentrack-video) +    target_link_libraries(${self} opencv_core opencv_imgproc opencv_calib3d opencv_video opentrack-cv opentrack-video)  endif() 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; | 
