diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-12-09 18:30:34 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-12-09 18:30:34 +0100 |
commit | b6d5f1708e7a5f27d2ac46a817ac5a45c1f692c3 (patch) | |
tree | 703c08ad0a78d20dfb3b0f5ce2ffdc93a92d8002 /tracker-pt/point_extractor.cpp | |
parent | 5196a67e23b24612b05d535cc8cf6797268c391c (diff) |
tracker/pt: inline meanshift eval fun
Diffstat (limited to 'tracker-pt/point_extractor.cpp')
-rw-r--r-- | tracker-pt/point_extractor.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp index e09af056..2cabf3a6 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -42,14 +42,6 @@ static cv::Vec2d MeanShiftIteration(const cv::Mat &frame_gray, const cv::Vec2d & // Most amazingling this function runs faster with doubles than with floats. const double s = 1.0 / filter_width; - auto EvalFilter = [¤t_center, s](int row, int col) - { - double dx = (col - current_center[0])*s; - double dy = (row - current_center[1])*s; - double f = std::max(0.0, 1.0 - dx*dx - dy*dy); - return f; - }; - double m = 0; cv::Vec2d com(0.0, 0.0); for (int i = 0; i < frame_gray.rows; i++) @@ -59,7 +51,12 @@ static cv::Vec2d MeanShiftIteration(const cv::Mat &frame_gray, const cv::Vec2d & { double val = frame_ptr[j]; val = val * val; // taking the square wights brighter parts of the image stronger. - val *= EvalFilter(i, j); + { + double dx = (j - current_center[0])*s; + double dy = (i - current_center[1])*s; + double f = std::max(0.0, 1.0 - dx*dx - dy*dy); + val *= f; + } m += val; com[0] += j * val; com[1] += i * val; |