diff options
-rw-r--r-- | FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui | 161 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp | 43 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp | 1 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h | 3 |
4 files changed, 81 insertions, 127 deletions
diff --git a/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui b/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui index 6cd17e8d..ce708849 100644 --- a/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui +++ b/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui @@ -10,7 +10,7 @@ <x>0</x>
<y>0</y>
<width>459</width>
- <height>590</height>
+ <height>621</height>
</rect>
</property>
<property name="sizePolicy">
@@ -66,105 +66,65 @@ <property name="title">
<string>Tracker Thread</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="1" column="3">
- <layout class="QHBoxLayout" name="horizontalLayout_12">
- <item>
- <widget class="QSpinBox" name="reset_spin">
- <property name="toolTip">
- <string>Time until automatic reset of tracker's internal state when no valid tracking result is found</string>
- </property>
- <property name="maximum">
- <number>9999</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_42">
- <property name="text">
- <string>ms</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="3">
- <widget class="QCheckBox" name="dynpose_check">
- <property name="toolTip">
- <string/>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QLabel" name="label_17">
- <property name="text">
- <string>Dynamic Pose Resolution</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="label_39">
- <property name="text">
- <string>Sleep time</string>
- </property>
- <property name="buddy">
- <cstring>sleep_spin</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QLabel" name="label_43">
- <property name="text">
- <string>Auto-reset time</string>
- </property>
- <property name="buddy">
- <cstring>reset_spin</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <layout class="QHBoxLayout" name="horizontalLayout_11">
- <item>
- <widget class="QSpinBox" name="sleep_spin">
- <property name="toolTip">
- <string>Time the tracker thread sleeps after each processed frame</string>
- </property>
- <property name="suffix">
- <string/>
- </property>
- <property name="maximum">
- <number>9999</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_40">
- <property name="text">
- <string>ms</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="3" column="3">
- <widget class="QPushButton" name="reset_button">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Reset the tracker's internal state</string>
- </property>
- <property name="text">
- <string>Reset</string>
- </property>
- </widget>
- </item>
- </layout>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_43">
+ <property name="text">
+ <string>Auto-reset time</string>
+ </property>
+ <property name="buddy">
+ <cstring>reset_spin</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="reset_spin">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Time until automatic reset of tracker's internal state when no valid tracking result is found</string>
+ </property>
+ <property name="suffix">
+ <string>ms</string>
+ </property>
+ <property name="maximum">
+ <number>9999</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_17">
+ <property name="text">
+ <string>Dynamic Pose Resolution</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="dynpose_check">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="reset_button">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Reset the tracker's internal state</string>
+ </property>
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
</item>
</layout>
</widget>
@@ -1759,7 +1719,6 @@ </widget>
<tabstops>
<tabstop>tabWidget</tabstop>
- <tabstop>sleep_spin</tabstop>
<tabstop>reset_spin</tabstop>
<tabstop>chkEnableRoll</tabstop>
<tabstop>chkEnablePitch</tabstop>
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp index fad53d60..e8bc7208 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp @@ -70,31 +70,28 @@ void Tracker::run() bool new_frame;
forever
{
- {
- QMutexLocker lock(&mutex);
-
- if (commands & ABORT) break;
- if (commands & PAUSE) continue;
- commands = 0;
-
- dt = time.elapsed() / 1000.0;
- time.restart();
-
- new_frame = camera.get_frame(dt, &frame);
- if (new_frame && !frame.empty())
- {
- frame = frame_rotation.rotate_frame(frame);
- const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame, dt, has_observers());
- tracking_valid = point_tracker.track(points, camera.get_info().f, dt);
- video_widget->update_image(frame.clone());
- }
+ QMutexLocker lock(&mutex);
+
+ if (commands & ABORT) break;
+ if (commands & PAUSE) continue;
+ commands = 0;
+
+ dt = time.elapsed() / 1000.0;
+ time.restart();
+
+ new_frame = camera.get_frame(dt, &frame);
+ if (new_frame && !frame.empty())
+ {
+ frame = frame_rotation.rotate_frame(frame);
+ const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame, dt, has_observers());
+ tracking_valid = point_tracker.track(points, camera.get_info().f, dt);
+ video_widget->update_image(frame.clone());
+ }
#ifdef PT_PERF_LOG
- log_stream<<"dt: "<<dt;
- if (!frame.empty()) log_stream<<" fps: "<<camera.get_info().fps;
- log_stream<<"\n";
+ log_stream<<"dt: "<<dt;
+ if (!frame.empty()) log_stream<<" fps: "<<camera.get_info().fps;
+ log_stream<<"\n";
#endif
- }
- msleep(s.sleep_time);
}
qDebug()<<"Tracker:: Thread stopping";
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp index a88e3a07..06f7b2c6 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp @@ -43,7 +43,6 @@ TrackerDialog::TrackerDialog() ui.camroll_combo->addItem("90");
tie_setting(s.dyn_pose_res, ui.dynpose_check);
- tie_setting(s.sleep_time, ui.sleep_spin);
tie_setting(s.reset_time, ui.reset_spin);
tie_setting(s.cam_index, ui.camdevice_combo);
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h index a828ea48..564e1264 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h @@ -36,7 +36,7 @@ struct settings value<int> t_MH_x, t_MH_y, t_MH_z;
- value<int> sleep_time, reset_time;
+ value<int> reset_time;
value<bool> bEnableYaw, bEnablePitch, bEnableRoll;
value<bool> bEnableX, bEnableY, bEnableZ;
@@ -69,7 +69,6 @@ struct settings t_MH_x(b, "model-centroid-x", 0),
t_MH_y(b, "model-centroid-y", 0),
t_MH_z(b, "model-centroid-z", 0),
- sleep_time(b, "sleep-time", 0),
reset_time(b, "reset-time", 0),
bEnableYaw(b, "enable-yaw", true),
bEnablePitch(b, "enable-pitch", true),
|