diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-01-04 13:41:46 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-01-04 13:41:46 +0100 |
commit | 8b845f242495a91aca45cd1bf59d1823517b32c8 (patch) | |
tree | b7c1cee3ed3944c6affc31c2fd1df431f2ae8c28 /FTNoIR_Tracker_PT/pt_video_widget.cpp | |
parent | 66466d0c30e7a2aed1a0c6c45db4b86dd5f0a99e (diff) |
disable hysteresis debug; throttle frame update rate
Diffstat (limited to 'FTNoIR_Tracker_PT/pt_video_widget.cpp')
-rw-r--r-- | FTNoIR_Tracker_PT/pt_video_widget.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
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();
|