summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-03-28 09:20:49 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-03-28 09:48:27 +0100
commitfead54d20879b7b9af19f445ae469a459278234f (patch)
tree0fba2494757ab97242a766539d1ced0c37fbe987
parent6187e16e33794925b57d602c62f37592e8dc8f70 (diff)
tracker/kinect: avoid malloc
-rw-r--r--tracker-kinect-face/camera_kinect_ir.cpp3
-rw-r--r--tracker-kinect-face/camera_kinect_ir.h1
2 files changed, 2 insertions, 2 deletions
diff --git a/tracker-kinect-face/camera_kinect_ir.cpp b/tracker-kinect-face/camera_kinect_ir.cpp
index 5c18f4f4..15bb7dca 100644
--- a/tracker-kinect-face/camera_kinect_ir.cpp
+++ b/tracker-kinect-face/camera_kinect_ir.cpp
@@ -238,7 +238,7 @@ bool CameraKinectIr::get_frame_(cv::Mat& frame)
//ProcessInfrared(nTime, pBuffer, nWidth, nHeight);
// Create an OpenCV matrix with our 16-bits IR buffer
- cv::Mat raw = cv::Mat(nHeight, nWidth, CV_16UC1, pBuffer);
+ cv::Mat raw = cv::Mat(height, width, CV_16UC1, pBuffer, cv::Mat::AUTO_STEP);
// Convert that OpenCV matrix to an RGB one as this is what is expected by our point extractor
// TODO: Ideally we should implement a point extractors that works with our native buffer
@@ -248,7 +248,6 @@ bool CameraKinectIr::get_frame_(cv::Mat& frame)
//cv::minMaxLoc(raw, &min, &max); // Should we use 16bit min and max instead?
// For scalling to have more precission in the range we are interrested in
min = max - 255;
- cv::Mat raw8;
// See: https://stackoverflow.com/questions/14539498/change-type-of-mat-object-from-cv-32f-to-cv-8u/14539652
raw.convertTo(raw8, CV_8U, 255.0 / (max - min), -255.0*min / (max - min));
// Second convert to RGB
diff --git a/tracker-kinect-face/camera_kinect_ir.h b/tracker-kinect-face/camera_kinect_ir.h
index dbe6fd63..cb525f72 100644
--- a/tracker-kinect-face/camera_kinect_ir.h
+++ b/tracker-kinect-face/camera_kinect_ir.h
@@ -67,6 +67,7 @@ private:
video::frame iFrame;
cv::Mat iMatFrame;
+ cv::Mat raw8;
};
}