summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/point_extractor.h
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-06-22 07:27:36 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-06-22 07:27:36 +0200
commit0ebf074be440dc5ba30802fdccfc786c6d4acbd7 (patch)
tree0545c270b4a58ca65b3b1a66466de9521c2a10da /tracker-pt/point_extractor.h
parentfdbc5017ede5dc0f31e1fa61aa8dc254810558ac (diff)
tracker/pt: replace point extraction algorithm
Profiling over a longer time period showed a bottleneck while iterating pixels with `cv::floodFill()'. Contours are actually faster, and we have MeanShift to establish the proper center basing on pixel intensities.
Diffstat (limited to 'tracker-pt/point_extractor.h')
-rw-r--r--tracker-pt/point_extractor.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/tracker-pt/point_extractor.h b/tracker-pt/point_extractor.h
index 0b179376..ac632b74 100644
--- a/tracker-pt/point_extractor.h
+++ b/tracker-pt/point_extractor.h
@@ -17,17 +17,19 @@
#include <vector>
+//#define DEBUG_MEANSHIFT
+
namespace pt_extractor_impl {
using namespace types;
struct blob
{
- double radius, brightness;
+ double radius, value;
vec2 pos;
cv::Rect rect;
- blob(double radius, const cv::Vec2d& pos, double brightness, cv::Rect &rect);
+ blob(double radius, const cv::Vec2d& pos, double value, const cv::Rect &rect);
};
class PointExtractor final
@@ -42,12 +44,13 @@ public:
private:
static constexpr int max_blobs = 16;
- cv::Mat frame_gray;
- cv::Mat frame_bin;
- cv::Mat hist;
- cv::Mat frame_blobs;
+ cv::Mat1b frame_bin, frame_gray;
+ //cv::Mat1b frame_blobs;
+ cv::Mat1f hist;
std::vector<blob> blobs;
+ std::vector<std::vector<cv::Point>> contours;
+ //std::vector<cv::Point> hull;
};
} // ns pt_extractor_impl