diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-03-28 09:20:49 +0100 |
---|---|---|
committer | Stéphane Lenclud <github@lenclud.com> | 2019-03-28 17:45:05 +0100 |
commit | 553d1a57244c1f8870dd3e83fbd9619a441db74b (patch) | |
tree | 3004bc457598f3f6ca3a117eb3eb363e76c66d71 | |
parent | 47d4b25bd0583b1fd65ae885950efd34c9df256b (diff) |
tracker/kinect: avoid malloc
-rw-r--r-- | tracker-kinect-face/camera_kinect_ir.cpp | 3 | ||||
-rw-r--r-- | tracker-kinect-face/camera_kinect_ir.h | 1 |
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; }; } |