diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-03-28 09:22:06 +0100 |
---|---|---|
committer | Stéphane Lenclud <github@lenclud.com> | 2019-03-28 17:45:05 +0100 |
commit | d3445ae71743de358516d295294f4f569f1adfa5 (patch) | |
tree | da49fba6770b767c9c407f1368d0dcc260f2e889 /tracker-kinect-face/camera_kinect_ir.cpp | |
parent | 553d1a57244c1f8870dd3e83fbd9619a441db74b (diff) |
tracker/kinect: get metadata only on first frame
Diffstat (limited to 'tracker-kinect-face/camera_kinect_ir.cpp')
-rw-r--r-- | tracker-kinect-face/camera_kinect_ir.cpp | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/tracker-kinect-face/camera_kinect_ir.cpp b/tracker-kinect-face/camera_kinect_ir.cpp index 15bb7dca..f80eb73f 100644 --- a/tracker-kinect-face/camera_kinect_ir.cpp +++ b/tracker-kinect-face/camera_kinect_ir.cpp @@ -198,34 +198,40 @@ bool CameraKinectIr::get_frame_(cv::Mat& frame) if (SUCCEEDED(hr)) { INT64 nTime = 0; - IFrameDescription* frameDescription = NULL; - int nWidth = 0; - int nHeight = 0; - float diagonalFieldOfView = 0.0f; UINT nBufferSize = 0; UINT16 *pBuffer = NULL; hr = iInfraredFrame->get_RelativeTime(&nTime); - if (SUCCEEDED(hr)) + if (first_frame) { - hr = iInfraredFrame->get_FrameDescription(&frameDescription); - } + IFrameDescription* frameDescription = NULL; - // TODO: should not request those info for a every frame really - if (SUCCEEDED(hr)) - { - hr = frameDescription->get_Width(&nWidth); - } + if (SUCCEEDED(hr)) + { + hr = iInfraredFrame->get_FrameDescription(&frameDescription); + } - if (SUCCEEDED(hr)) - { - hr = frameDescription->get_Height(&nHeight); - } + // TODO: should not request those info for a every frame really + if (SUCCEEDED(hr)) + { + hr = frameDescription->get_Width(&width); + } - if (SUCCEEDED(hr)) - { - hr = frameDescription->get_DiagonalFieldOfView(&diagonalFieldOfView); + if (SUCCEEDED(hr)) + { + hr = frameDescription->get_Height(&height); + } + + if (SUCCEEDED(hr)) + { + hr = frameDescription->get_DiagonalFieldOfView(&fov); + } + + if (SUCCEEDED(hr)) + first_frame = false; + + SafeRelease(frameDescription); } if (SUCCEEDED(hr)) @@ -255,8 +261,6 @@ bool CameraKinectIr::get_frame_(cv::Mat& frame) // success = true; } - - SafeRelease(frameDescription); } |