summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStéphane Lenclud <github@lenclud.com>2019-02-03 14:11:00 +0100
committerStéphane Lenclud <github@lenclud.com>2019-02-07 13:24:14 +0100
commit58cc914eb84cb4257904e401a91c0cd5fe3aebf7 (patch)
tree0e08575a26305186d526f66d4b49a0471199a549
parentecaf8b6403f57e5813190f4ae1b89780c45339d8 (diff)
Kinect: CMake adjustments following code review.
-rw-r--r--tracker-kinect-face/CMakeLists.txt20
-rw-r--r--tracker-kinect-face/kinect_face_tracker.cpp5
2 files changed, 16 insertions, 9 deletions
diff --git a/tracker-kinect-face/CMakeLists.txt b/tracker-kinect-face/CMakeLists.txt
index e12534b2..690f82e7 100644
--- a/tracker-kinect-face/CMakeLists.txt
+++ b/tracker-kinect-face/CMakeLists.txt
@@ -4,18 +4,18 @@ if (WIN32)
if(OpenCV_FOUND)
# Setup cache variable to Kinect SDK path
if(DEFINED ENV{KINECTSDK20_DIR})
- set(KINECTSDK20_DIR $ENV{KINECTSDK20_DIR} CACHE PATH $ENV{KINECTSDK20_DIR})
+ set(SDK_KINECT20 $ENV{KINECTSDK20_DIR} CACHE PATH $ENV{KINECTSDK20_DIR})
else()
- set(KINECTSDK20_DIR $ENV{KINECTSDK20_DIR} CACHE PATH "")
+ set(SDK_KINECT20 $ENV{KINECTSDK20_DIR} CACHE PATH "")
endif()
# If we have a valid SDK path, try build that tracker
- if(EXISTS ${KINECTSDK20_DIR})
+ if(EXISTS ${SDK_KINECT20})
# Register our module
otr_module(tracker-kinect-face)
# Add include path to Kinect SDK
- target_include_directories(opentrack-tracker-kinect-face SYSTEM PUBLIC ${KINECTSDK20_DIR}/inc)
+ target_include_directories(opentrack-tracker-kinect-face SYSTEM PUBLIC "${SDK_KINECT20}/inc")
# Check processor architecture
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
@@ -23,18 +23,20 @@ if (WIN32)
set (kinect-arch-dir "x86")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
# 64 bits
- set (kinect-arch-dir "x64")
+ set (kinect-arch-dir "x64")
+ else()
+ message(FATAL_ERROR "Kinect: architecture not supported!")
endif()
# Link against Kinect SDK libraries
- target_link_libraries(opentrack-tracker-kinect-face ${KINECTSDK20_DIR}/lib/${kinect-arch-dir}/Kinect20.lib ${KINECTSDK20_DIR}/lib/${kinect-arch-dir}/Kinect20.Face.lib)
+ target_link_libraries(opentrack-tracker-kinect-face "${SDK_KINECT20}/lib/${kinect-arch-dir}/Kinect20.lib" "${SDK_KINECT20}/lib/${kinect-arch-dir}/Kinect20.Face.lib")
# Link against OpenCV stuff, needed for video preview
target_link_libraries(opentrack-tracker-kinect-face opencv_imgproc opentrack-cv opencv_core)
# Install Kinect Face DLL
- install(FILES ${KINECTSDK20_DIR}/Redist/Face/${kinect-arch-dir}/Kinect20.Face.dll DESTINATION ./modules/ PERMISSIONS ${opentrack-perms-exec})
+ install(FILES "${SDK_KINECT20}/Redist/Face/${kinect-arch-dir}/Kinect20.Face.dll" DESTINATION "./modules/" PERMISSIONS ${opentrack-perms-exec})
# Install Kinect Face Database
- install(DIRECTORY ${KINECTSDK20_DIR}/Redist/Face/${kinect-arch-dir}/NuiDatabase DESTINATION ./modules/)
- endif(EXISTS ${KINECTSDK20_DIR})
+ install(DIRECTORY "${SDK_KINECT20}/Redist/Face/${kinect-arch-dir}/NuiDatabase" DESTINATION "./modules/")
+ endif(EXISTS ${SDK_KINECT20})
endif(OpenCV_FOUND)
endif(WIN32) \ No newline at end of file
diff --git a/tracker-kinect-face/kinect_face_tracker.cpp b/tracker-kinect-face/kinect_face_tracker.cpp
index 51990693..0b7775bc 100644
--- a/tracker-kinect-face/kinect_face_tracker.cpp
+++ b/tracker-kinect-face/kinect_face_tracker.cpp
@@ -186,6 +186,11 @@ void KinectFaceTracker::data(double *data)
iLastFacePosition = iFacePosition;
iLastFaceRotation = iFaceRotation;
}
+ else
+ {
+ //TODO: after like 5s without tracking reset position to zero
+ //TODO: Instead of hardcoding that delay add it to our settings
+ }
// Feed our framework our last valid position and rotation
data[0] = (iLastFacePosition.X - iFacePositionCenter.X) * 100; // Convert to centimer to be in a range that suites OpenTrack.