From 77cf9ec80947da8d82f8a9d514c98595765454d6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 1 Mar 2017 20:35:16 +0100 Subject: tracker/pt: don't crash in cv::resize next hotfix or bust --- tracker-pt/ftnoir_tracker_pt.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tracker-pt/ftnoir_tracker_pt.cpp') diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index 6110e22e..5c3e338a 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -71,10 +71,10 @@ void Tracker_PT::run() new_frame = camera.get_frame(dt, frame, cam_info); } - cv::resize(frame, preview_frame, cv::Size(preview_size.width(), preview_size.height()), 0, 0, cv::INTER_NEAREST); - - if (new_frame && !frame.empty()) + if (new_frame) { + cv::resize(frame, preview_frame, cv::Size(preview_size.width(), preview_size.height()), 0, 0, cv::INTER_NEAREST); + point_extractor.extract_points(frame, preview_frame, points); point_count = points.size(); @@ -154,8 +154,12 @@ void Tracker_PT::apply_settings() void Tracker_PT::start_tracker(QFrame* video_frame) { - video_frame->setAttribute(Qt::WA_NativeWindow); + //video_frame->setAttribute(Qt::WA_NativeWindow); preview_size = video_frame->size(); + + preview_frame = cv::Mat(video_frame->height(), video_frame->width(), CV_8UC3); + preview_frame.setTo(cv::Scalar(0, 0, 0)); + video_widget = qptr(video_frame); layout = qptr(video_frame); layout->setContentsMargins(0, 0, 0, 0); -- cgit v1.2.3