summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/ftnoir_tracker_pt.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-06-09 11:43:04 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-06-09 11:43:04 +0200
commit7b07d63e8129b620d275845c5d79573aac72a800 (patch)
tree40677974ca967af42ccd30cd9b8c53c279d35bb5 /tracker-pt/ftnoir_tracker_pt.cpp
parent1b9dcf43be582c2719b9d5bf10b15acd59eac944 (diff)
tracker/pt: only reset camera input when needed
Diffstat (limited to 'tracker-pt/ftnoir_tracker_pt.cpp')
-rw-r--r--tracker-pt/ftnoir_tracker_pt.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp
index 6dd40ceb..14813b62 100644
--- a/tracker-pt/ftnoir_tracker_pt.cpp
+++ b/tracker-pt/ftnoir_tracker_pt.cpp
@@ -153,15 +153,29 @@ void Tracker_PT::run()
void Tracker_PT::apply_settings()
{
- qDebug()<<"Tracker:: Applying settings";
+ qDebug() << "Tracker:: Applying settings";
QMutexLocker l(&camera_mtx);
- camera.stop();
- camera.set_device_index(camera_name_to_index(s.camera_name));
- camera.set_res(s.cam_res_x, s.cam_res_y);
- camera.set_fps(s.cam_fps);
- camera.start();
- frame = cv::Mat();
- qDebug()<<"Tracker::apply ends";
+
+ CamInfo info = camera.get_desired();
+ const QString name = camera.get_desired_name();
+
+ if (s.cam_fps != info.fps ||
+ s.cam_res_x != info.res_x ||
+ s.cam_res_y != info.res_y ||
+ s.camera_name != name)
+ {
+ qDebug() << "pt: camera reset needed";
+ camera.stop();
+ camera.set_device(s.camera_name);
+ camera.set_res(s.cam_res_x, s.cam_res_y);
+ camera.set_fps(s.cam_fps);
+ frame = cv::Mat();
+ camera.start();
+ }
+ else
+ qDebug() << "pt: camera not needing reset";
+
+ qDebug() << "Tracker::apply ends";
}
void Tracker_PT::start_tracker(QFrame *parent_window)