From 9da39ce65e42097b5f05eed2ce2cd40cf234ef73 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 20 Sep 2016 23:08:10 +0200 Subject: tracker/pt: merge from unstable - the pose estimator doesn't need locking at all - only return point count to the dialog, reducing locking - allow for only 8 pixels difference between consecutive dynamic pose frames at 640x480, half that at 320x240 - extract points taking in account pixel brightness, not merely contours - in case of more than three points, prefer the brightest ones scoring on radius and average pixel brightness --- tracker-pt/point_extractor.h | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'tracker-pt/point_extractor.h') diff --git a/tracker-pt/point_extractor.h b/tracker-pt/point_extractor.h index 3e4661f9..142ad60e 100644 --- a/tracker-pt/point_extractor.h +++ b/tracker-pt/point_extractor.h @@ -1,4 +1,5 @@ /* Copyright (c) 2012 Patrick Ruoff + * Copyright (c) 2015-2016 Stanislaw Halik * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -12,44 +13,39 @@ #include #include "ftnoir_tracker_pt_settings.h" -#include +#include #include -class PointExtractor +class PointExtractor final { public: // extracts points from frame and draws some processing info into frame, if draw_output is set // dt: time since last call in seconds // WARNING: returned reference is valid as long as object - const std::vector &extract_points(cv::Mat &frame); - int get_n_points() { QMutexLocker l(&mtx); return points.size(); } + void extract_points(cv::Mat& frame, std::vector& points); PointExtractor(); - + settings_pt s; private: - enum { hist_c = 2 }; - std::vector points; - QMutex mtx; + static constexpr int max_blobs = 16; + cv::Mat frame_gray; cv::Mat frame_bin; cv::Mat hist; - - enum { max_blobs = 16 }; + cv::Mat frame_blobs; struct blob { - double radius; + double radius, brightness; cv::Vec2d pos; - double confid; - blob(double radius, const cv::Vec2d& pos, double confid) : radius(radius), pos(pos), confid(confid) + blob(double radius, const cv::Vec2d& pos, double brightness) : radius(radius), brightness(brightness), pos(pos) { - //qDebug() << "radius" << radius << "pos" << pos[0] << pos[1] << "confid" << confid; + //qDebug() << "radius" << radius << "pos" << pos[0] << pos[1]; } }; std::vector blobs; - std::vector> contours; }; #endif //POINTEXTRACTOR_H -- cgit v1.2.3