"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Turning Scanner On/Off

My application uses the CloudReco's scanner by calling the CRParentViewController method in a storyboard from a menu.  The scanning works great.  I add a modal view afterwards.  However, when I try returning to the main menu and then calling the CRParentViewController again, I can not start up the scanner.  I know I need to add the targetFinder->startInit method to kick off scanning again and deinitialize the scanner when I move to my modal view.  As a result, I have added a deinitializeTracker method as follows:

 

- (void)deinitializeTracker {

    

    // Background thread must have its own autorelease pool

    NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();

    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));

    if (imageTracker == NULL)

    {

        NSLog(@"Failed to load tracking data set because the ImageTracker has not been initialized.");

        

    }

    

    QCAR::TargetFinder *targetFinder = imageTracker->getTargetFinder();

    if (targetFinder == NULL) {

        NSLog(@"Fialed to get target finder.");

    }

    

    // Deinitialize Visual Search

    targetFinder->deinit();

 

    [pool release];

}

 

I later call the loadTracker method in my ARViewController's ViewDidLoad method.  Unfortunately, I get the following error:

"Failed to load tracking data set because the ImageTracker has not been initialized"

 

Suggestions are welcome.

 

 

Hi jackmann,
 
This is because Vuforia has not currently been designed to init() and deinit() within the same session.

Please see this thread for more details and a workaround:

Thanks for your reply.  I have read the threads and understand the tab view application.  I have also looked through the specification and have tried using several of the  methods available in the QCARutils class.

The cloud reco sample turns off the scanning functionality when it is displaying book covers, alternating between states using enterScanningMode() and enterContentMode()

Additionally the other technique is simply to use pauseAR() and resumeAR()

 

No luck.  I've been tracing the code for the attempted scanning of the 2nd image.  When I enter CRParentViewController the 2nd time, the videostream has already been started.

I tried writing another method in CRQCARutils.mm to shut down the tracker. I call this method before creating my modal view to leave the tracker.  I'm guessing that it's only partially doing the job as I still cannot start scanning again after returning to the main menu.