Log in or register to post comments

desactivate current Dataset and activate another one at runtime

January 20, 2017 - 5:06am #1

Hi !

 

i'm facing with a problem using Vuforia on Android (Java).

Using the object recognition I've  the aim to load all my bases on dataset List (that ok for this), activate one and wait for a time.

 

Once the timemout fired, i want to desactivate the current dataset, unload trackers data, and activate another dataset on object tracker (which is already loaded, so).

 

But i'm facing a problem during the change, following this :

public void switchDataset() {

        mDatasetIndex++;

        if(mDatasetIndex == mDatasets.size()){

            mDatasetIndex = 0;

        }

        doUnloadTrackersData();

        TrackerManager tManager = TrackerManager.getInstance();

        ObjectTracker objectTracker = (ObjectTracker) tManager

                .getTracker(ObjectTracker.getClassType());

        if (objectTracker == null) {

            Log.e(LOGCAT, "OBJECT TRACKER IS NULL");

        } else {

            objectTracker.stop();

            objectTracker.deactivateDataSet(mCurrentDataset);

            mCurrentDataset = mDatasets.get(1);

            objectTracker.activateDataSet(mCurrentDataset);

            objectTracker.start();

        }

        doLoadTrackersData();

    }

 

I tried with 3 dataset, the first one (so first load) is OK.

The second one too, i can recognize and object from the second dataset.

But when I trying on the 3°, the camera freezes and the app is blocked.

 

Anyone has an idea ? 

 

Thanks in advance !

Log in or register to post comments