summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-01 20:35:16 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-03-01 20:35:16 +0100
commit77cf9ec80947da8d82f8a9d514c98595765454d6 (patch)
tree29d91493b5a1ff2361092dbc2ec1f9eb7dd365aa
parent303c83792cd034fc2bf40e71edde968c22df5324 (diff)
tracker/pt: don't crash in cv::resize
next hotfix or bust
-rw-r--r--gui/main-window.ui20
-rw-r--r--tracker-pt/ftnoir_tracker_pt.cpp12
2 files changed, 27 insertions, 5 deletions
diff --git a/gui/main-window.ui b/gui/main-window.ui
index 33ee99d3..db75a20d 100644
--- a/gui/main-window.ui
+++ b/gui/main-window.ui
@@ -99,7 +99,7 @@
<item>
<widget class="QFrame" name="video_feed">
<property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -110,6 +110,12 @@
<height>240</height>
</size>
</property>
+ <property name="maximumSize">
+ <size>
+ <width>320</width>
+ <height>240</height>
+ </size>
+ </property>
<widget class="QFrame" name="video_frame">
<property name="geometry">
<rect>
@@ -125,6 +131,18 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="minimumSize">
+ <size>
+ <width>320</width>
+ <height>240</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>320</width>
+ <height>240</height>
+ </size>
+ </property>
<widget class="QLabel" name="video_frame_label">
<property name="geometry">
<rect>
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<cv_video_widget>(video_frame);
layout = qptr<QHBoxLayout>(video_frame);
layout->setContentsMargins(0, 0, 0, 0);