diff options
author | Stéphane Lenclud <github@lenclud.com> | 2019-04-14 14:26:26 +0200 |
---|---|---|
committer | Stéphane Lenclud <github@lenclud.com> | 2019-04-24 18:46:12 +0200 |
commit | 69a16a5bb45eafe185fa708f572788908ce9ebff (patch) | |
tree | 53964e955e5ede7b6601598367c6a13dfbcfd3c3 /tracker-easy | |
parent | a814bff460cff1263e236e465c7ef8c8f88baf55 (diff) |
Easy Tracker: Fixing issues with preview head point cross.
Diffstat (limited to 'tracker-easy')
-rw-r--r-- | tracker-easy/preview.cpp | 4 | ||||
-rw-r--r-- | tracker-easy/tracker-easy.cpp | 31 | ||||
-rw-r--r-- | tracker-easy/tracker-easy.h | 3 |
3 files changed, 18 insertions, 20 deletions
diff --git a/tracker-easy/preview.cpp b/tracker-easy/preview.cpp index 7f245ae4..a44ab143 100644 --- a/tracker-easy/preview.cpp +++ b/tracker-easy/preview.cpp @@ -109,11 +109,11 @@ namespace EasyTracker cv::line(iFrameRgb, cv::Point(px - len, py), cv::Point(px + len, py), - color, 1); + color, 2); cv::line(iFrameRgb, cv::Point(px, py - len), cv::Point(px, py + len), - color, 1); + color, 2); } void Preview::ensure_size(cv::Mat& frame, int w, int h, int type) diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp index acedc379..7850a23e 100644 --- a/tracker-easy/tracker-easy.cpp +++ b/tracker-easy/tracker-easy.cpp @@ -36,7 +36,7 @@ namespace EasyTracker Tracker::Tracker() : s{ KModuleName }, - point_extractor{ std::make_unique<PointExtractor>() }, + iPointExtractor{ std::make_unique<PointExtractor>() }, iPreview{ preview_width, preview_height } { cv::setBreakOnError(true); @@ -58,7 +58,7 @@ namespace EasyTracker wait(); QMutexLocker l(&camera_mtx); - camera->stop(); + camera->stop(); } @@ -138,21 +138,9 @@ namespace EasyTracker } iPoints.clear(); - point_extractor->extract_points(iMatFrame, (preview_visible ? &iPreview.iFrameRgb : nullptr), iPoints); + iPointExtractor->extract_points(iMatFrame, (preview_visible ? &iPreview.iFrameRgb : nullptr), iPoints); point_count.store(iPoints.size(), std::memory_order_relaxed); - - if (preview_visible) - { - //iPreview = iMatFrame; - cv::imshow("Preview", iPreview.iFrameRgb); - cv::waitKey(1); - } - else - { - cv::destroyWindow("Preview"); - } - const bool success = iPoints.size() >= KPointCount; int topPointIndex = -1; @@ -307,13 +295,19 @@ namespace EasyTracker } if (preview_visible) - { + { + // if (topPointIndex != -1) { // Render a cross to indicate which point is the head iPreview.draw_head_center(iPoints[topPointIndex][0], iPoints[topPointIndex][1]); } + // Show full size preview pop-up + cv::imshow("Preview", iPreview.iFrameRgb); + cv::waitKey(1); + + // Update preview widget widget->update_image(iPreview.get_bitmap()); auto[w, h] = widget->preview_size(); @@ -324,6 +318,11 @@ namespace EasyTracker iPreview = Preview(w, h); } } + else + { + // No preview, destroy preview pop-up + cv::destroyWindow("Preview"); + } } } } diff --git a/tracker-easy/tracker-easy.h b/tracker-easy/tracker-easy.h index 57419c1c..fe7fece7 100644 --- a/tracker-easy/tracker-easy.h +++ b/tracker-easy/tracker-easy.h @@ -38,7 +38,6 @@ namespace EasyTracker { friend class Dialog; - explicit Tracker(); ~Tracker() override; module_status start_tracker(QFrame* parent_window) override; @@ -63,7 +62,7 @@ namespace EasyTracker int preview_width = 320, preview_height = 240; - std::unique_ptr<IPointExtractor> point_extractor; + std::unique_ptr<IPointExtractor> iPointExtractor; std::unique_ptr<video::impl::camera> camera; video::impl::camera::info iCameraInfo; std::unique_ptr<video_widget> widget; |