Esempio n. 1
0
JNIEXPORT int JNICALL
Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_destroyTrackerData(JNIEnv *, jobject)
{
	LOG("Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_destroyTrackerData");

	// Get the image tracker:
	QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
	QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
			trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
	if (imageTracker == NULL)
	{
		LOG("Failed to destroy the tracking data set because the ImageTracker has not"
				" been initialized.");
		return 0;
	}

	if (dataSetStonesAndChips != 0)
	{
		if (imageTracker->getActiveDataSet() == dataSetStonesAndChips &&
				!imageTracker->deactivateDataSet(dataSetStonesAndChips))
		{
			LOG("Failed to destroy the tracking data set StonesAndChips because the data set "
					"could not be deactivated.");
			return 0;
		}

		if (!imageTracker->destroyDataSet(dataSetStonesAndChips))
		{
			LOG("Failed to destroy the tracking data set StonesAndChips.");
			return 0;
		}

		LOG("Successfully destroyed the data set StonesAndChips.");
		dataSetStonesAndChips = 0;
	}

	if (dataSetTarmac != 0)
	{
		if (imageTracker->getActiveDataSet() == dataSetTarmac &&
				!imageTracker->deactivateDataSet(dataSetTarmac))
		{
			LOG("Failed to destroy the tracking data set Tarmac because the data set "
					"could not be deactivated.");
			return 0;
		}

		if (!imageTracker->destroyDataSet(dataSetTarmac))
		{
			LOG("Failed to destroy the tracking data set Tarmac.");
			return 0;
		}

		LOG("Successfully destroyed the data set Tarmac.");
		dataSetTarmac = 0;
	}

	return 1;
}
Esempio n. 2
0
JNIEXPORT int JNICALL
Java_edu_pugetsound_vichar_ar_ARGameActivity_destroyTrackerData(JNIEnv *, jobject)
{
    LOG("Java_edu_pugetsound_vichar_ar_ARGameActivity_destroyTrackerData");

    // Get the image tracker:
    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
        trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
    if (imageTracker == NULL)
    {
        LOG("Failed to destroy the tracking data set because the ImageTracker has not"
            " been initialized.");
        return 0;
    }

    if (dataSetVichar != 0)
    {
        if (imageTracker->getActiveDataSet() == dataSetVichar &&
            !imageTracker->deactivateDataSet(dataSetVichar))
        {
            LOG("Failed to destroy the tracking data set vichar because the data set "
                "could not be deactivated.");
            return 0;
        }

        if (!imageTracker->destroyDataSet(dataSetVichar))
        {
            LOG("Failed to destroy the tracking data set vichar.");
            return 0;
        }

        LOG("Successfully destroyed the data set vichar.");
        dataSetVichar = 0;
    }

    if (dataSetFlakesBox != 0)
    {
        if (imageTracker->getActiveDataSet() == dataSetFlakesBox &&
            !imageTracker->deactivateDataSet(dataSetFlakesBox))
        {
            LOG("Failed to destroy the tracking data set FlakesBox because the data set "
                "could not be deactivated.");
            return 0;
        }

        if (!imageTracker->destroyDataSet(dataSetFlakesBox))
        {
            LOG("Failed to destroy the tracking data set FlakesBox.");
            return 0;
        }

        LOG("Successfully destroyed the data set FlakesBox.");
        dataSetFlakesBox = 0;
    }

    return 1;
}
Esempio n. 3
0
JNIEXPORT int JNICALL
Java_com_robopeak_EasyQCAR_EasyQCAR_destroy(JNIEnv *, jobject)
{
    LOGI("EasyQCAR_destroy");

    // Get the image tracker:
    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
                                           trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
    if (imageTracker == NULL)
    {
        LOGE("Failed to destroy the tracking data set because the ImageTracker has not"
             " been initialized.");
        return 0;
    }

    if (g_dataSet != 0)
    {
        if (!imageTracker->deactivateDataSet(g_dataSet))
        {
            LOGE("Failed to destroy the tracking data set because the data set "
                 "could not be deactivated.");
            return 0;
        }

        if (!imageTracker->destroyDataSet(g_dataSet))
        {
            LOGE("Failed to destroy the tracking data set.");
            return 0;
        }

        LOGI("Successfully destroyed the data set.");
        g_dataSet = 0;
        return 1;
    }

    //Destroy the image tracker
    trackerManager.deinitTracker(QCAR::Tracker::IMAGE_TRACKER);

    LOGI("No tracker data set to destroy.");
    return 0;
}
JNIEXPORT int JNICALL
Java_rajawali_vuforia_RajawaliVuforiaActivity_destroyTrackerData(JNIEnv *env,
		jobject object) {
	LOG("Java_rajawali_vuforia_RajawaliVuforiaRenderer_destroyTrackerData");

	QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
	QCAR::ImageTracker* imageTracker =
			static_cast<QCAR::ImageTracker*>(trackerManager.getTracker(
					QCAR::ImageTracker::getClassType()));
	if (imageTracker == NULL) {
		return 0;
	}

	for (int tIdx = 0; tIdx < imageTracker->getActiveDataSetCount(); tIdx++) {
		QCAR::DataSet* dataSet = imageTracker->getActiveDataSet(tIdx);
		imageTracker->deactivateDataSet(dataSet);
		imageTracker->destroyDataSet(dataSet);
	}

	return 1;
}
MSTracker::~MSTracker() {
    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
                                           trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));

    if (imageTracker != NULL && this->dataset != 0)
    {
        imageTracker->deactivateDataSet(this->dataset);
        int n = this->dataset->getNumTrackables();
        for (int i = 0; i < n; ++i) {
            QCAR::Trackable *t = this->dataset->getTrackable(i);
            if (t->getUserData()) {
                MSTargetInfo *info = static_cast<MSTargetInfo *>(t->getUserData());
                delete info;
                t->setUserData(NULL);
            }
        }
        imageTracker->destroyDataSet(this->dataset);
        this->dataset = NULL;
    }

    trackerManager.deinitTracker(QCAR::Tracker::IMAGE_TRACKER);
}
Esempio n. 6
0
JNIEXPORT int JNICALL
Java_com_mx_ipn_escom_ars_recorrido_ReconocerActivity_destroyTrackerData(JNIEnv *, jobject)
{
    LOG("Java_com_mx_ipn_escom_ars_recorrido_ReconocerActivity_destroyTrackerData");

    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
        trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
    if (imageTracker == NULL)
    {
        LOG("Failed to destroy the tracking data set because the ImageTracker has not"
            " been initialized.");
        return 0;
    }

    if (dataSetStonesAndChips2 != 0)
    {
        if (imageTracker->getActiveDataSet() == dataSetStonesAndChips2 &&
            !imageTracker->deactivateDataSet(dataSetStonesAndChips2))
        {
            LOG("Failed to destroy the tracking data set StonesAndChips because the data set "
                "could not be deactivated.");
            return 0;
        }

        if (!imageTracker->destroyDataSet(dataSetStonesAndChips2))
        {
            LOG("Failed to destroy the tracking data set StonesAndChips.");
            return 0;
        }

        LOG("Successfully destroyed the data set StonesAndChips.");
        dataSetStonesAndChips2 = 0;
    }

    return 1;
}
Esempio n. 7
0
    virtual void QCAR_onUpdate(QCAR::State& /*state*/)
    {
        if (switchDataSetAsap)
        {
            switchDataSetAsap = false;

            // Get the image tracker:
            QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
            QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
                trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
            if (imageTracker == 0 || dataSetStonesAndChips == 0 ||
                imageTracker->getActiveDataSet() == 0)
            {
                LOG("Failed to switch data set.1 = %d, 2 = %d, 3 = %d", imageTracker, dataSetStonesAndChips, imageTracker->getActiveDataSet());
                return;
            }
            
            if (imageTracker->getActiveDataSet() == dataSetStonesAndChips)
            {
                imageTracker->deactivateDataSet(dataSetStonesAndChips);
                imageTracker->destroyDataSet(dataSetStonesAndChips);

                LOG("Load dynamically new data set Start");
                LOG("DataSetName %s", dataSetName);

                // Get the image tracker:
                QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
                QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
                	trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
                if (imageTracker == NULL)
                {
                	LOG("Failed to load tracking data set because the ImageTracker has not"
                    " been initialized.");
                    return;
                }

                // Create the data sets:
                dataSetStonesAndChips = imageTracker->createDataSet();
                if (dataSetStonesAndChips == 0)
                {
                	LOG("Failed to create a new tracking data.");
                    return;
                }
                LOG("Load data set from device");
                char path[strlen("/mnt/sdcard/") + strlen(dataSetName) + strlen(".xml")];
                strcpy(path, "/mnt/sdcard/");
                strcat(path, dataSetName);
                strcat(path, ".xml");

                LOG("Path %s", path);
                // Load the data sets:
                if (!dataSetStonesAndChips->load(path, QCAR::DataSet::STORAGE_ABSOLUTE))
                {
                	LOG("Failed to load data set.");
                    return;
                }

                // Activate the data set:
                if (!imageTracker->activateDataSet(dataSetStonesAndChips))
                {
                	LOG("Failed to activate data set.");
                    return;
                }

                LOG("Load dynamically new data set End");


                //imageTracker->activateDataSet(dataSetTarmac);
            }
            else
            {
                //imageTracker->deactivateDataSet(dataSetTarmac);
                imageTracker->activateDataSet(dataSetStonesAndChips);
            }
        }
    }