summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-12-19 19:48:55 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-12-19 19:48:55 +0100
commita2ceed01e32fd941e20e1362b6c44af8db05b5b2 (patch)
tree4894cb5d83ee47e38fada4817eba5197766f467a
parent487ee12372d054ec8d6cfaf534ca8c6639d0b96f (diff)
tracker/pt: cv::Mat::at<T> is slow, use cv::Mat::ptr
-rw-r--r--tracker-pt/point_extractor.cpp3
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;