summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStéphane Lenclud <github@lenclud.com>2019-04-14 14:26:26 +0200
committerStéphane Lenclud <github@lenclud.com>2019-04-14 14:26:26 +0200
commit56160ea9dedc086e74962f8c74a7f96d576653c3 (patch)
tree09a7a6a1af92f90e499ac31b53e132a4337f224c
parent3b19264b7425ecd13c5c7ab470cb3c91dd257d44 (diff)
Easy Tracker: Fixing issues with preview head point cross.
-rw-r--r--tracker-easy/preview.cpp4
-rw-r--r--tracker-easy/tracker-easy.cpp31
-rw-r--r--tracker-easy/tracker-easy.h3
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;