summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-12-18 21:28:30 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-12-18 21:28:30 +0100
commit487ee12372d054ec8d6cfaf534ca8c6639d0b96f (patch)
treee6b06ce83bc1a0c754346a319e742392dcad9b5d
parent377202f037aeff97481252bdc7856cfacf939b66 (diff)
tracker/pt: avoid widget malloc when able
-rw-r--r--tracker-pt/pt_video_widget.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tracker-pt/pt_video_widget.cpp b/tracker-pt/pt_video_widget.cpp
index 860d0a77..8c18e678 100644
--- a/tracker-pt/pt_video_widget.cpp
+++ b/tracker-pt/pt_video_widget.cpp
@@ -16,7 +16,13 @@ void PTVideoWidget::update_image(const cv::Mat& frame)
if (!freshp)
{
- _frame = frame.clone();
+ if (_frame.cols != frame.cols ||
+ _frame.rows != frame.rows ||
+ _frame.channels() != frame.channels())
+ {
+ _frame = cv::Mat();
+ }
+ frame.copyTo(_frame);
freshp = true;
}
}