From f65ee6280df9fd9b583bc9fff12dc880a42c3435 Mon Sep 17 00:00:00 2001 From: Stéphane Lenclud Date: Sun, 5 May 2019 19:12:39 +0200 Subject: Make sure Kinect IR sensor is not registered if no Kinect is found on the system. --- tracker-kinect-face/camera_kinect_ir.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tracker-kinect-face/camera_kinect_ir.cpp') diff --git a/tracker-kinect-face/camera_kinect_ir.cpp b/tracker-kinect-face/camera_kinect_ir.cpp index c5b21572..75945d49 100644 --- a/tracker-kinect-face/camera_kinect_ir.cpp +++ b/tracker-kinect-face/camera_kinect_ir.cpp @@ -14,6 +14,7 @@ #include "compat/sleep.hpp" #include "compat/math-imports.hpp" +#include "video-opencv/camera-names.hpp" #include #include @@ -47,10 +48,10 @@ namespace Kinect { std::vector CamerasProvider::camera_names() const { - IKinectSensor* kinect; - if (SUCCEEDED(GetDefaultKinectSensor(&kinect))) + if (camera_name_to_index("Kinect V2 Video Sensor") != -1) { - SafeRelease(kinect); + // We found Kinect V2 Video Sensor therefore we have a kinect V2 connected. + // Publish our Kinect V2 IR Sensor implementation then. return { KKinectIRSensor }; } else -- cgit v1.2.3