summaryrefslogtreecommitdiffhomepage
path: root/tracker-kinect-face
diff options
context:
space:
mode:
authorStéphane Lenclud <github@lenclud.com>2019-05-05 19:12:39 +0200
committerStéphane Lenclud <github@lenclud.com>2019-05-05 19:12:39 +0200
commitf65ee6280df9fd9b583bc9fff12dc880a42c3435 (patch)
treeb20f34135fca76561229f744694158089f2880d5 /tracker-kinect-face
parentd34276dd7a5346413bd6f25d324d052dbfb600c7 (diff)
Make sure Kinect IR sensor is not registered if no Kinect is found on the system.
Diffstat (limited to 'tracker-kinect-face')
-rw-r--r--tracker-kinect-face/CMakeLists.txt3
-rw-r--r--tracker-kinect-face/camera_kinect_ir.cpp7
2 files changed, 7 insertions, 3 deletions
diff --git a/tracker-kinect-face/CMakeLists.txt b/tracker-kinect-face/CMakeLists.txt
index be764369..31b52ff7 100644
--- a/tracker-kinect-face/CMakeLists.txt
+++ b/tracker-kinect-face/CMakeLists.txt
@@ -7,6 +7,9 @@ if (WIN32 AND opentrack-intel)
# Register our module
otr_module(tracker-kinect-face)
+ target_sources(${self} PUBLIC "../video-opencv/camera-names.cpp")
+ target_link_libraries(${self} strmiids)
+
if(MSVC)
# workaround warning in SDK
target_compile_options(${self} PRIVATE "-wd4471")
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 <opencv2/imgproc.hpp>
#include <cstdlib>
@@ -47,10 +48,10 @@ namespace Kinect {
std::vector<QString> 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