From a2ceed01e32fd941e20e1362b6c44af8db05b5b2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 19 Dec 2015 19:48:55 +0100 Subject: tracker/pt: cv::Mat::at is slow, use cv::Mat::ptr --- tracker-pt/point_extractor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tracker-pt') 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 PointExtractor::extract_points(cv::Mat& frame) int cnt = 0; constexpr int min_pixels = 250; const auto pixels_to_include = std::max(0, min_pixels * s.threshold/100.); + auto ptr = reinterpret_cast(hist.ptr(0)); for (int i = sz-1; i >= 0; i--) { - cnt += hist.at(i); + cnt += ptr[i]; if (cnt >= pixels_to_include) { val = i; -- cgit v1.2.3