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.
Turning Scanner On/Off
Please see this thread for more details and a workaround:
Turning Scanner On/Off
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.
Turning Scanner On/Off
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()
Turning Scanner On/Off
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.
Turning Scanner On/Off
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.