From 0a85531e359dcde7aecdd486c6789cbeab93463f Mon Sep 17 00:00:00 2001 From: Stéphane Lenclud Date: Wed, 17 Apr 2019 17:59:48 +0200 Subject: Easy Tracker: Experimented with erode/dilate and mean/cam shift. It does not bring much. --- tracker-easy/CMakeLists.txt | 2 +- tracker-easy/point-extractor.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) 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 #include #include +#include +// Needed for mean shift +#include #include + 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; -- cgit v1.2.3