From 8b845f242495a91aca45cd1bf59d1823517b32c8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 4 Jan 2014 13:41:46 +0100 Subject: disable hysteresis debug; throttle frame update rate --- FTNoIR_Tracker_PT/pt_video_widget.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'FTNoIR_Tracker_PT/pt_video_widget.cpp') diff --git a/FTNoIR_Tracker_PT/pt_video_widget.cpp b/FTNoIR_Tracker_PT/pt_video_widget.cpp index 5ac002f4..38c49567 100644 --- a/FTNoIR_Tracker_PT/pt_video_widget.cpp +++ b/FTNoIR_Tracker_PT/pt_video_widget.cpp @@ -18,7 +18,15 @@ using namespace std; void PTVideoWidget::update_image(const cv::Mat& frame) { QMutexLocker foo(&mtx); - _frame = frame; + const int rate = 40; + if (freshp) + return; + if (!update_throttler.isValid() || update_throttler.elapsed() > rate) + { + _frame = frame.clone(); + update_throttler.restart(); + freshp = true; + } } // ---------------------------------------------------------------------------- @@ -42,8 +50,9 @@ VideoWidgetDialog::VideoWidgetDialog(QWidget *parent, FrameProvider* provider) void PTVideoWidget::update_and_repaint() { QMutexLocker foo(&mtx); - if (_frame.empty()) + if (_frame.empty() || !freshp) return; + freshp = false; QImage qframe = QImage(_frame.cols, _frame.rows, QImage::Format_RGB888); uchar* data = qframe.bits(); const int pitch = qframe.bytesPerLine(); -- cgit v1.2.3