diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 0f87e2f063..d0c57424a5 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1788,6 +1788,7 @@ void Application::initMenu() { _testPing->setChecked(true); (_fullScreenMode = optionsMenu->addAction("Fullscreen", this, SLOT(setFullscreen(bool)), Qt::Key_F))->setCheckable(true); optionsMenu->addAction("Webcam", &_webcam, SLOT(setEnabled(bool)))->setCheckable(true); + optionsMenu->addAction("Toggle Skeleton Tracking", &_webcam, SLOT(setSkeletonTrackingOn(bool)))->setCheckable(true); optionsMenu->addAction("Cycle Webcam Send Mode", _webcam.getGrabber(), SLOT(cycleVideoSendMode())); optionsMenu->addAction("Go Home", this, SLOT(goHome())); diff --git a/interface/src/Webcam.cpp b/interface/src/Webcam.cpp index b30d72aec6..8fdf5f8687 100644 --- a/interface/src/Webcam.cpp +++ b/interface/src/Webcam.cpp @@ -33,7 +33,7 @@ int jointVectorMetaType = qRegisterMetaType("JointVector"); int matMetaType = qRegisterMetaType("cv::Mat"); int rotatedRectMetaType = qRegisterMetaType("cv::RotatedRect"); -Webcam::Webcam() : _enabled(false), _active(false), _colorTextureID(0), _depthTextureID(0) { +Webcam::Webcam() : _enabled(false), _active(false), _colorTextureID(0), _depthTextureID(0), _skeletonTrackingOn(false) { // the grabber simply runs as fast as possible _grabber = new FrameGrabber(); _grabber->moveToThread(&_grabberThread); @@ -197,7 +197,7 @@ void Webcam::setFrame(const Mat& color, int format, const Mat& depth, float midF _aspectRatio = aspectRatio; _faceRect = faceRect; _sending = sending; - _joints = joints; + _joints = _skeletonTrackingOn ? joints : JointVector(); _frameCount++; const int MAX_FPS = 60; diff --git a/interface/src/Webcam.h b/interface/src/Webcam.h index 1df6a846a8..35c85cc63a 100644 --- a/interface/src/Webcam.h +++ b/interface/src/Webcam.h @@ -47,6 +47,7 @@ public: FrameGrabber* getGrabber() { return _grabber; } bool isActive() const { return _active; } + bool isSending() const { return _sending; } GLuint getColorTextureID() const { return _colorTextureID; } @@ -62,13 +63,14 @@ public: const JointVector& getEstimatedJoints() const { return _estimatedJoints; } void reset(); - void renderPreview(int screenWidth, int screenHeight); + void renderPreview(int screenWidth, int screenHeight); public slots: void setEnabled(bool enabled); void setFrame(const cv::Mat& color, int format, const cv::Mat& depth, float midFaceDepth, float aspectRatio, const cv::RotatedRect& faceRect, bool sending, const JointVector& joints); + void setSkeletonTrackingOn(bool toggle) { _skeletonTrackingOn = toggle; }; private: @@ -95,6 +97,8 @@ private: glm::vec3 _estimatedPosition; glm::vec3 _estimatedRotation; JointVector _estimatedJoints; + + bool _skeletonTrackingOn; }; class FrameGrabber : public QObject {