]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/commitdiff
Allow getting filter response
authorMichal Sojka <michal.sojka@cvut.cz>
Wed, 12 Sep 2018 10:00:44 +0000 (12:00 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Wed, 12 Sep 2018 10:02:55 +0000 (12:02 +0200)
It roughly corresponds to tracker's view of tracking accuracy. This value
is produced even when ground truth data is not available.

PITOM wanted to have this for their drone use case.

Fixes #19.

main_vot.cpp
src/kcf.cpp
src/kcf.h

index a07a73367b2da6a87c61b3bfbfe9b4a3555f9b79..4a8c99e38adffad8b9041712e7548339e37c4288 100644 (file)
@@ -145,7 +145,8 @@ int main(int argc, char *argv[])
         double time_profile_counter = cv::getCPUTickCount();
         tracker.track(image);
         time_profile_counter = cv::getCPUTickCount() - time_profile_counter;
-         std::cout << "  -> speed : " <<  time_profile_counter/((double)cvGetTickFrequency()*1000) << "ms. per frame";
+         std::cout << "  -> speed : " <<  time_profile_counter/((double)cvGetTickFrequency()*1000) << "ms. per frame, "
+                      "response : " << tracker.getFilterResponse();
         avg_time += time_profile_counter/((double)cvGetTickFrequency()*1000);
         frames++;
 
index 8a1d98005dd18a00cdadee87eeac6cea7d27d062..d06322d6af5ec8f061ff6acf091f4cecce428d11 100644 (file)
@@ -294,6 +294,11 @@ BBox_c KCF_Tracker::getBBox()
     return tmp;
 }
 
+double KCF_Tracker::getFilterResponse() const
+{
+    return this->max_response;
+}
+
 void KCF_Tracker::track(cv::Mat &img)
 {
     if (m_debug) std::cout << "NEW FRAME" << '\n';
@@ -319,7 +324,7 @@ void KCF_Tracker::track(cv::Mat &img)
         }
     }
 
-    double max_response = -1.;
+    max_response = -1.;
     ThreadCtx *max = nullptr;
     cv::Point2i *max_response_pt = nullptr;
     cv::Mat *max_response_map = nullptr;
index 044934592a8e1210bec435c2dc32a834c92c5917..079d1221d0110d5fced20bef18fe930a583c46c0 100644 (file)
--- a/src/kcf.h
+++ b/src/kcf.h
@@ -97,11 +97,14 @@ public:
     // frame-to-frame object tracking
     void track(cv::Mat & img);
     BBox_c getBBox();
+    double getFilterResponse() const; // Measure of tracking accuracy
 
 private:
     Fft &fft;
 
     BBox_c p_pose;
+    double max_response = -1.;
+
     bool p_resize_image = false;
     bool p_fit_to_pw2 = false;