summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/camera.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-12-19 20:43:24 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-12-19 20:46:26 +0100
commit90138a999b4c95afeb9a49d355b0234b6145e221 (patch)
treeec1c749b9837dc3dee7d37dbb8facb38aee4a854 /tracker-pt/camera.cpp
parenta2ceed01e32fd941e20e1362b6c44af8db05b5b2 (diff)
tracker/pt: don't allocate temporary frame
Diffstat (limited to 'tracker-pt/camera.cpp')
-rw-r--r--tracker-pt/camera.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/tracker-pt/camera.cpp b/tracker-pt/camera.cpp
index ff721557..600ab26a 100644
--- a/tracker-pt/camera.cpp
+++ b/tracker-pt/camera.cpp
@@ -110,19 +110,14 @@ bool CVCamera::_get_frame(cv::Mat* frame)
{
if (cap && cap->isOpened())
{
- cv::Mat img;
- for (int i = 0; i < 100 && !cap->read(img); i++)
+ for (int i = 0; i < 100 && !cap->read(*frame); i++)
;;
- if (img.empty())
+ if (frame->empty())
return false;
- if (frame->rows != img.rows || frame->cols != img.cols)
- *frame = cv::Mat();
-
- *frame = img;
- cam_info.res_x = img.cols;
- cam_info.res_y = img.rows;
+ cam_info.res_x = frame->cols;
+ cam_info.res_y = frame->rows;
return true;
}
return false;