diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-09-28 23:37:04 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-09-28 23:37:04 +0200 |
commit | 8cfd801a3b96acdcf9a91ceeda04471ad7dd5c75 (patch) | |
tree | 73dd182488d6927758e4753e9024d271bd0bd5e8 /tracker-pt/point_extractor.cpp | |
parent | cca9299636ac2f2768256aef2d527d1be22b1616 (diff) |
tracker/pt: don't check for blob limit pointlessly
It's branch predicted anyway, but for clarity.
Diffstat (limited to 'tracker-pt/point_extractor.cpp')
-rw-r--r-- | tracker-pt/point_extractor.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp index ce3edb4a..48816780 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -90,16 +90,13 @@ void PointExtractor::extract_points(cv::Mat& frame, std::vector<vec2>& points) unsigned idx = 0; for (int y=0; y < frame_blobs.rows; y++) { - if (idx >= max_blobs) break; - const unsigned char* ptr_bin = frame_blobs.ptr(y); for (int x=0; x < frame_blobs.cols; x++) { - if (idx >= max_blobs) break; - if (ptr_bin[x] != 255) continue; idx = blobs.size() + 1; + cv::Rect rect; cv::floodFill(frame_blobs, cv::Point(x,y), @@ -155,9 +152,12 @@ void PointExtractor::extract_points(cv::Mat& frame, std::vector<vec2>& points) cv::Scalar(0, 0, 255), 1); } + + if (idx >= max_blobs) goto end; } } } +end: sort(blobs.begin(), blobs.end(), [](const blob& b1, const blob& b2) -> bool { return b2.brightness < b1.brightness; }); |