more surgical removal of WebCam with HAVE_LIBVPX

This commit is contained in:
Brad Hefta-Gaub 2014-01-13 15:00:15 -08:00
parent 8e8e6fcb30
commit b947d1e80c
3 changed files with 32 additions and 3 deletions

View file

@ -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");

View file

@ -30,16 +30,22 @@ using namespace std;
using namespace xn;
#endif
// register types with Qt metatype system
int jointVectorMetaType = qRegisterMetaType<JointVector>("JointVector");
int keyPointVectorMetaType = qRegisterMetaType<KeyPointVector>("KeyPointVector");
#ifdef HAVE_LIBVPX
int matMetaType = qRegisterMetaType<Mat>("cv::Mat");
int rotatedRectMetaType = qRegisterMetaType<RotatedRect>("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

View file

@ -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__) */