diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-16 08:59:21 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-16 08:59:21 +0100 |
commit | 6cf93c06abad63721bf66f695587a98377b6178d (patch) | |
tree | af029c638c9a62d6c34bc95a4dc3060c5d2f8921 /tracker-pt/ftnoir_tracker_pt.cpp | |
parent | 88849a1ca4b7c253f7427d361443a496c1b5fe28 (diff) |
cv/video-frame, tracker/pt: add hidpi preview support
Diffstat (limited to 'tracker-pt/ftnoir_tracker_pt.cpp')
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index 467334de..05959066 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -23,14 +23,13 @@ using namespace types; -static constexpr inline int preview_width = 320, preview_height = 240; - -Tracker_PT::Tracker_PT(const pt_runtime_traits& traits) : - s { traits.get_module_name() }, - point_extractor { traits.make_point_extractor() }, - camera { traits.make_camera() }, - frame { traits.make_frame() }, - preview_frame { traits.make_preview(preview_width, preview_height) } +Tracker_PT::Tracker_PT(pointer<pt_runtime_traits> traits) : + traits { traits }, + s { traits->get_module_name() }, + point_extractor { traits->make_point_extractor() }, + camera { traits->make_camera() }, + frame { traits->make_frame() }, + preview_frame { traits->make_preview(preview_width, preview_height) } { cv::setBreakOnError(true); @@ -106,6 +105,16 @@ void Tracker_PT::run() } video_widget->update_image(preview_frame->get_bitmap()); + + { + int w = -1, h = -1; + video_widget->get_preview_size(w, h); + if (w != preview_width || h != preview_height) + { + preview_width = w, preview_height = h; + preview_frame = traits->make_preview(w, h); + } + } } } qDebug() << "pt: thread stopped"; |