diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-12-18 19:57:42 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-12-18 19:57:42 +0100 |
commit | 8a60f1c9613d396b50aa6adec4b1f5ffdb9e9806 (patch) | |
tree | 7c92080112cfbcd0383fb3ff304abefa19a13379 /tracker-pt/point_extractor.cpp | |
parent | 84fb0aab5633a98fd2aef7d9e642628e826e2a9d (diff) |
tracker/pt: reduce mutex contention
Diffstat (limited to 'tracker-pt/point_extractor.cpp')
-rw-r--r-- | tracker-pt/point_extractor.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp index dd36c57f..6eb255a5 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -147,12 +147,13 @@ std::vector<cv::Vec2f> PointExtractor::extract_points(cv::Mat& frame) blobs.push_back(blob(radius, pos, confid, area)); } - // clear old points - points.clear(); - using b = const blob; std::sort(blobs.begin(), blobs.end(), [](b& b1, b& b2) {return b1.confid > b2.confid;}); + QMutexLocker l(&mtx); + + points.clear(); + for (auto& b : blobs) { cv::Vec2f p((b.pos[0] - W/2)/W, -(b.pos[1] - H/2)/W); |