Exemple #1
0
// ----------------------------------------------------------------------------
// Stops the Camera
// ----------------------------------------------------------------------------
JNIEXPORT void JNICALL
Java_com_qualcomm_QCARSamples_CloudRecognition_CloudReco_stopCamera(JNIEnv *,jobject)
{
    // Stop the tracker:
    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
            trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
    assert(imageTracker != 0);
    imageTracker->stop();

    // Stop cloud based recognition:
    QCAR::TargetFinder* targetFinder = imageTracker->getTargetFinder();
    assert (targetFinder != 0);
    crStarted = !targetFinder->stop();

    //Clears the trackables
    targetFinder->clearTrackables();

    QCAR::CameraDevice::getInstance().stop();
    QCAR::CameraDevice::getInstance().deinit();

    // When the camera stops it clears the Product Texture ID so next time textures
    // Are recreated
    deleteCurrentProductTexture = true;

    // Initialize all state Variables
    initStateVariables();
}
JNIEXPORT void JNICALL
Java_rajawali_vuforia_RajawaliVuforiaActivity_stopCamera(JNIEnv *, jobject) {
	LOG("Java_rajawali_vuforia_RajawaliVuforiaActivity_stopCamera");

	// Stop the tracker:
	QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
	QCAR::Tracker* markerTracker = trackerManager.getTracker(
			QCAR::MarkerTracker::getClassType());
	if (markerTracker != 0)
		markerTracker->stop();

	QCAR::ImageTracker* imageTracker =
			static_cast<QCAR::ImageTracker*>(trackerManager.getTracker(
					QCAR::ImageTracker::getClassType()));
	if (imageTracker != 0)
		imageTracker->stop();

	QCAR::CameraDevice::getInstance().stop();

	// Stop Cloud Reco:
	QCAR::TargetFinder* targetFinder = imageTracker->getTargetFinder();
	assert(targetFinder != 0);

	targetFinder->stop();

	// Clears the trackables
	targetFinder->clearTrackables();

	QCAR::CameraDevice::getInstance().deinit();

	initStateVariables();
}