Beispiel #1
0
JNIEXPORT int JNICALL
Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_loadTrackerData(JNIEnv *, jobject)
{
	LOG("Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_loadTrackerData");

	// 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 0;
	}

	// Create the data sets:
	dataSetStonesAndChips = imageTracker->createDataSet();
	if (dataSetStonesAndChips == 0)
	{
		LOG("Failed to create a new tracking data.");
		return 0;
	}

	dataSetTarmac = imageTracker->createDataSet();
	if (dataSetTarmac == 0)
	{
		LOG("Failed to create a new tracking data.");
		return 0;
	}

	// Load the data sets:
	if (!dataSetStonesAndChips->load("id.xml", QCAR::DataSet::STORAGE_APPRESOURCE))
	{
		LOG("Failed to load data set.");
		return 0;
	}

	if (!dataSetTarmac->load("id.xml", QCAR::DataSet::STORAGE_APPRESOURCE))
	{
		LOG("Failed to load data set.");
		return 0;
	}

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

	LOG("Successfully loaded and activated data set.");
	return 1;
}
Beispiel #2
0
JNIEXPORT int JNICALL
Java_edu_pugetsound_vichar_ar_ARGameActivity_loadTrackerData(JNIEnv *, jobject)
{
    LOG("Java_edu_pugetsound_vichar_ar_ARGameActivity_loadTrackerData");

    // 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 0;
    }

    // Create the data sets:
    dataSetVichar = imageTracker->createDataSet();
    if (dataSetVichar == 0)
    {
        LOG("Failed to create a new tracking data.");
        return 0;
    }

    dataSetFlakesBox = imageTracker->createDataSet();
    if (dataSetFlakesBox == 0)
    {
        LOG("Failed to create a new tracking data.");
        return 0;
    }

    // Load the data sets:
    if (!dataSetVichar->load("vichar.xml", QCAR::DataSet::STORAGE_APPRESOURCE))
    {
        LOG("Failed to load data set.");
        return 0;
    }

    if (!dataSetFlakesBox->load("FlakesBox.xml", QCAR::DataSet::STORAGE_APPRESOURCE))
    {
        LOG("Failed to load data set.");
        return 0;
    }

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

    LOG("Successfully loaded and activated data set.");
    return 1;
}
MSTracker::MSTracker() {
    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(trackerManager.initTracker(QCAR::Tracker::IMAGE_TRACKER));

    // Create and activate the data set:
    this->dataset = imageTracker->createDataSet();
    imageTracker->activateDataSet(this->dataset);
}
Beispiel #4
0
JNIEXPORT int JNICALL
Java_com_robopeak_EasyQCAR_EasyQCAR_create(JNIEnv* env, jobject, jstring trackerXml)
{
    LOGI("EasyQCAR_create");

    // 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)
    {
        imageTracker = static_cast<QCAR::ImageTracker*>(trackerManager.initTracker(QCAR::Tracker::IMAGE_TRACKER));
        if (imageTracker == NULL)
        {
            LOGE("Failed to initialize ImageTracker.");
            return 0;
        }

        LOGI("Successfully initialized ImageTracker.");
    }

    // Create the data sets:
    g_dataSet = imageTracker->createDataSet();
    if (g_dataSet == 0)
    {
        LOGE("Failed to create a new tracking data.");
        return 0;
    }
    // Load the data sets:
    const char* c_xml = env->GetStringUTFChars(trackerXml, 0);
    if (!g_dataSet->load(c_xml, QCAR::DataSet::STORAGE_APPRESOURCE))
    {
        LOGE("Failed to load data set %s.", c_xml);
        return 0;
    }
    env->ReleaseStringUTFChars(trackerXml, c_xml);

    // Activate the data set:
    if (!imageTracker->activateDataSet(g_dataSet))
    {
        LOGE("Failed to activate data set %s.", c_xml);
        return 0;
    }

    LOGI("Successfully loaded and activated data set %s.", c_xml);
    return 1;
}
JNIEXPORT int JNICALL
Java_com_mx_ipn_escom_ars_recorrido_ReconocerActivity_loadTrackerData(JNIEnv *env, jobject,jstring fileName)
{
    LOG("Java_com_mx_ipn_escom_ars_recorrido_ReconocerActivity_loadTrackerData");

    // 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 0;
    }

    dataSetStonesAndChips2 = imageTracker->createDataSet();
    if (dataSetStonesAndChips2 == 0)
    {
        LOG("Failed to create a new tracking data.");
        return 0;
    }

    const char *nativeString = env->GetStringUTFChars(fileName, 0);
    if (!dataSetStonesAndChips2->load(nativeString, QCAR::DataSet::STORAGE_ABSOLUTE))
    {
        LOG("Failed to load data set.");
        return 0;
    }

    env->ReleaseStringUTFChars(fileName, nativeString);

    if (!imageTracker->activateDataSet(dataSetStonesAndChips2))
    {
        LOG("Failed to activate data set.");
        return 0;
    }

    LOG("Successfully loaded and activated data set.");
    return 1;
}
JNIEXPORT int JNICALL
Java_rajawali_vuforia_RajawaliVuforiaActivity_createImageMarker(JNIEnv* env,
		jobject object, jstring dataSetFile) {
	QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
	QCAR::ImageTracker* imageTracker =
			static_cast<QCAR::ImageTracker*>(trackerManager.getTracker(
					QCAR::ImageTracker::getClassType()));

	if (imageTracker == NULL) {
		LOG("Failed to load tracking data set because the ImageTracker has not"
		" been initialized.");
		return 0;
	}

	QCAR::DataSet* dataSet = imageTracker->createDataSet();
	if (dataSet == 0) {
		LOG("Failed to create a new tracking data.");
		return 0;
	}

	// Load the data sets:
	const char *nativeString = env->GetStringUTFChars(dataSetFile, NULL);
	if (!dataSet->load(nativeString, QCAR::DataSet::STORAGE_APPRESOURCE)) {
		LOG("Failed to load data set.");
		env->ReleaseStringUTFChars(dataSetFile, nativeString);
		return 0;
	}
	env->ReleaseStringUTFChars(dataSetFile, nativeString);

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

	LOG("Successfully loaded and activated data set.");

	return 1;
}
Beispiel #7
0
JNIEXPORT jint JNICALL Java_com_tvc_supastriker_SupaStriker_loadTrackerData
  (JNIEnv *, jobject){
	LOG("Java_com_tvc_supastriker_SupaStriker_loadTrackerData");

	//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 ImageTracker has not "
				"been initialized");
		return 0;
	}

	//create the data sets:
	dataSetSupaStrika = imageTracker->createDataSet();
	if(dataSetSupaStrika == 0){
		LOG("Failed to create new tracking data..");
		return 0;
	}

	//Load datasets..
	if(!dataSetSupaStrika->load("SupaStrikas_db.xml", QCAR::DataSet::STORAGE_APPRESOURCE)){
		LOG("Failed to load data set..");
		return 0;
	}

	//Activate the dataset
	if(!imageTracker->activateDataSet(dataSetSupaStrika)){
		LOG("Failed to activate data set");
	}

	LOG("Successfully loaded and activated the data set");
	return 1;
}
Beispiel #8
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);
            }
        }
    }
	JNIEXPORT int JNICALL
	Java_com_miosys_finder_ui_PfinderTargets_loadTrackerData(JNIEnv *, jobject)
	{
	    LOG("Java_com_miosys_finder_ui_PfinderTargets_loadTrackerData");

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

	    // Create the data sets:
	    dataSetStonesAndChips = imageTracker->createDataSet();
	    if (dataSetStonesAndChips == 0)
	    {
	        LOG("Failed to create a new tracking data.");
	        return 0;
	    }

	    dataSetTarmac = imageTracker->createDataSet();
	    if (dataSetTarmac == 0)
	    {
	        LOG("Failed to create a new tracking data.");
	        return 0;
	    }

	    dataSetvmio_vuforial_dev = imageTracker->createDataSet();
	    if(dataSetvmio_vuforial_dev == 0){
	    	LOG("Failed to create a new Tracking data.");
	    	return 0;
	    }


	    // Load the data sets:
	    if (!dataSetStonesAndChips->load("StonesAndChips.xml", QCAR::DataSet::STORAGE_APPRESOURCE))
	    {
	        LOG("Failed to load data set.");
	        return 0;
	    }

	    if (!dataSetTarmac->load("Tarmac.xml", QCAR::DataSet::STORAGE_APPRESOURCE))
	    {
	        LOG("Failed to load data set.");
	        return 0;
	    }

	    if(!dataSetvmio_vuforial_dev->load("vmio_vuforia_dev.xml", QCAR::DataSet::STORAGE_APPRESOURCE))
	    {
	    	LOG("Failed to load data set vmio.");
	    	return 0;
	    }
	    // Activate the data set:
	//    if (!imageTracker->activateDataSet(dataSetStonesAndChips))
	//    {
	//        LOG("Failed to activate data set.");
	//        return 0;
	//    }

	    if (!imageTracker->activateDataSet(dataSetvmio_vuforial_dev))
	    {
	          LOG("Failed to activate data set.");
	          return 0;
	    }
	    LOG("Successfully loaded and activated data set.");
	    return 1;
	}