diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-12-19 19:48:55 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-12-19 19:48:55 +0100 |
commit | a2ceed01e32fd941e20e1362b6c44af8db05b5b2 (patch) | |
tree | 4894cb5d83ee47e38fada4817eba5197766f467a | |
parent | 487ee12372d054ec8d6cfaf534ca8c6639d0b96f (diff) |
tracker/pt: cv::Mat::at<T> is slow, use cv::Mat::ptr
-rw-r--r-- | tracker-pt/point_extractor.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp index 6eb255a5..6118f3d2 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -74,9 +74,10 @@ std::vector<cv::Vec2f> PointExtractor::extract_points(cv::Mat& frame) int cnt = 0; constexpr int min_pixels = 250; const auto pixels_to_include = std::max<int>(0, min_pixels * s.threshold/100.); + auto ptr = reinterpret_cast<const float*>(hist.ptr(0)); for (int i = sz-1; i >= 0; i--) { - cnt += hist.at<float>(i); + cnt += ptr[i]; if (cnt >= pixels_to_include) { val = i; |