diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index f87d2d074b..0a9ee86cf2 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -342,6 +342,7 @@ Menu::Menu() : SLOT(setTCPEnabled(bool))); addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::ChatCircling, 0, true); +#ifdef HAVE_LIBVPX QMenu* webcamOptionsMenu = developerMenu->addMenu("Webcam Options"); addCheckableActionToQMenuAndActionHash(webcamOptionsMenu, @@ -363,6 +364,8 @@ Menu::Menu() : false, appInstance->getWebcam()->getGrabber(), SLOT(setDepthOnly(bool))); +#endif //def HAVE_LIBVPX + QMenu* handOptionsMenu = developerMenu->addMenu("Hand Options"); @@ -389,13 +392,16 @@ Menu::Menu() : false, appInstance->getWebcam(), SLOT(setSkeletonTrackingOn(bool))); - + +#ifdef HAVE_LIBVPX addCheckableActionToQMenuAndActionHash(trackingOptionsMenu, MenuOption::LEDTracking, 0, false, appInstance->getWebcam()->getGrabber(), SLOT(setLEDTrackingOn(bool))); +#endif //def HAVE_LIBVPX + addDisabledActionAndSeparator(developerMenu, "Testing"); diff --git a/interface/src/devices/Webcam.cpp b/interface/src/devices/Webcam.cpp index 7a9ec686e3..04a7e71ff8 100644 --- a/interface/src/devices/Webcam.cpp +++ b/interface/src/devices/Webcam.cpp @@ -30,16 +30,22 @@ using namespace std; using namespace xn; #endif + // register types with Qt metatype system int jointVectorMetaType = qRegisterMetaType("JointVector"); int keyPointVectorMetaType = qRegisterMetaType("KeyPointVector"); + +#ifdef HAVE_LIBVPX int matMetaType = qRegisterMetaType("cv::Mat"); int rotatedRectMetaType = qRegisterMetaType("cv::RotatedRect"); +#endif //def HAVE_LIBVPX -Webcam::Webcam() : _enabled(false), _active(false), _colorTextureID(0), _depthTextureID(0), _skeletonTrackingOn(false) { +Webcam::Webcam() : _enabled(false), _active(false), _colorTextureID(0), _depthTextureID(0), _skeletonTrackingOn(false), _grabber(NULL) { // the grabber simply runs as fast as possible +#ifdef HAVE_LIBVPX _grabber = new FrameGrabber(); _grabber->moveToThread(&_grabberThread); +#endif // def HAVE_LIBVPX } void Webcam::setEnabled(bool enabled) { @@ -175,6 +181,8 @@ Webcam::~Webcam() { #endif } +#ifdef HAVE_LIBVPX + static glm::vec3 createVec3(const Point2f& pt) { return glm::vec3(pt.x, -pt.y, 0.0f); } @@ -247,6 +255,9 @@ static float computeTransformFromKeyPoints(const KeyPointVector& keyPoints, glm: const float METERS_PER_MM = 1.0f / 1000.0f; +#endif //def HAVE_LIBVPX + + void Webcam::setFrame(const Mat& color, int format, const Mat& depth, float midFaceDepth, float aspectRatio, const RotatedRect& faceRect, bool sending, const JointVector& joints, const KeyPointVector& keyPoints) { #ifdef HAVE_LIBVPX @@ -1037,7 +1048,6 @@ void FrameGrabber::destroyCodecs() { #endif } -#endif //def HAVE_LIBVPX Joint::Joint(const glm::vec3& position, const glm::quat& rotation, const glm::vec3& projected) : @@ -1046,3 +1056,5 @@ Joint::Joint(const glm::vec3& position, const glm::quat& rotation, const glm::ve Joint::Joint() : isValid(false) { } + +#endif //def HAVE_LIBVPX diff --git a/interface/src/devices/Webcam.h b/interface/src/devices/Webcam.h index f9c480606f..cbc7807254 100644 --- a/interface/src/devices/Webcam.h +++ b/interface/src/devices/Webcam.h @@ -109,6 +109,8 @@ private: bool _skeletonTrackingOn; }; +#ifdef HAVE_LIBVPX + /// Acquires and processes video frames in a dedicated thread. class FrameGrabber : public QObject { Q_OBJECT @@ -175,6 +177,9 @@ private: #endif }; +#endif //def HAVE_LIBVPX + + /// Contains the 3D transform and 2D projected position of a tracked joint. class Joint { public: @@ -190,7 +195,13 @@ public: Q_DECLARE_METATYPE(JointVector) Q_DECLARE_METATYPE(KeyPointVector) + + + +#ifdef HAVE_LIBVPX Q_DECLARE_METATYPE(cv::Mat) Q_DECLARE_METATYPE(cv::RotatedRect) +#endif //def HAVE_LIBVPX + #endif /* defined(__interface__Webcam__) */