From 38519c9d6f3941b4593ebd2a31d764c03f911ae9 Mon Sep 17 00:00:00 2001 From: glopesdev Date: Sat, 21 Nov 2015 23:55:24 +0000 Subject: [PATCH] Fixed #11. Added confidence calculation based on number of fused points. --- CMT.cpp | 6 ++++++ CMT.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/CMT.cpp b/CMT.cpp index be9ac38..e6f8a26 100644 --- a/CMT.cpp +++ b/CMT.cpp @@ -105,6 +105,9 @@ void CMT::initialize(const Mat im_gray, const Rect rect) classes_active = classes_fg; } + //Store initial set of keypoints for confidence calculation + points_initial = points_active; + FILE_LOG(logDEBUG) << "CMT::initialize() return"; } @@ -192,6 +195,9 @@ void CMT::processFrame(Mat im_gray) { //TODO: Use theta to suppress result bb_rot = RotatedRect(center, size_initial * scale, rotation/CV_PI * 180); + // Compute tracking confidence + confidence = (float)points_fused.size() / points_initial.size(); + //Remember current image im_prev = im_gray; diff --git a/CMT.h b/CMT.h index c8ed6e8..8f18821 100644 --- a/CMT.h +++ b/CMT.h @@ -36,12 +36,14 @@ class CMT vector points_active; //public for visualization purposes RotatedRect bb_rot; + float confidence; private: Ptr detector; Ptr descriptor; Size2f size_initial; + vector points_initial; vector classes_active;