diff --git a/interface/src/devices/Visage.cpp b/interface/src/devices/Visage.cpp index 119d89654a..70cdaf2b01 100644 --- a/interface/src/devices/Visage.cpp +++ b/interface/src/devices/Visage.cpp @@ -41,14 +41,8 @@ Visage::Visage() : _headOrigin(DEFAULT_HEAD_ORIGIN) { #ifdef HAVE_VISAGE -#ifdef WIN32 - QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage"; -#else - QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage/license.vlc"; -#endif - initializeLicenseManager(licensePath.data()); - _tracker = new VisageTracker2(Application::resourcesPath().toLatin1() + "visage/tracker.cfg"); - _data = new FaceData(); + _tracker = NULL; + _data = NULL; #endif } @@ -179,6 +173,19 @@ void Visage::setEnabled(bool enabled) { return; } if ((_enabled = enabled)) { + if(_tracker == NULL && _data == NULL){ + + #ifdef WIN32 + QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage"; + #else + QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage/license.vlc"; + #endif + + initializeLicenseManager(licensePath.data()); + _tracker = new VisageTracker2(Application::resourcesPath().toLatin1() + "visage/tracker.cfg"); + _data = new FaceData(); + } + _tracker->trackFromCam(); } else { _tracker->stop();