From b66bf8bccc9a52d8c24763010567da8c083c482e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 4 Jan 2014 13:26:04 +0100 Subject: PT: remove sleep interval The rationale is that camera blocks while the frame's being retrieved anyway. --- FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui | 161 +++++++++---------------- FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp | 43 +++---- FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp | 1 - 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 @@ 0 0 459 - 590 + 621 @@ -66,105 +66,65 @@ Tracker Thread - - - - - - - - - Time until automatic reset of tracker's internal state when no valid tracking result is found - - - 9999 - - - - - - - ms - - - - - - - - - - - - - - - - - - - Dynamic Pose Resolution - - - - - - - Sleep time - - - sleep_spin - - - - - - - Auto-reset time - - - reset_spin - - - - - - - - - Time the tracker thread sleeps after each processed frame - - - - - - 9999 - - - - - - - ms - - - - - - - - - false - - - Reset the tracker's internal state - - - Reset - - - - + + + + + Auto-reset time + + + reset_spin + + + + + + + + 0 + 0 + + + + Time until automatic reset of tracker's internal state when no valid tracking result is found + + + ms + + + 9999 + + + + + + + Dynamic Pose Resolution + + + + + + + + + + + + + + + + + false + + + Reset the tracker's internal state + + + Reset + + @@ -1759,7 +1719,6 @@ tabWidget - sleep_spin reset_spin chkEnableRoll chkEnablePitch 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& 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& 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: "<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 t_MH_x, t_MH_y, t_MH_z; - value sleep_time, reset_time; + value reset_time; value bEnableYaw, bEnablePitch, bEnableRoll; value 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), -- cgit v1.2.3