Log in or register to post comments

imageTracker.GetActiveDataSets() returns 0 elements

January 23, 2014 - 3:37am #1

Hello, anybody could you tell me why  the "GetActiveDataSets()" method from "ImageTracker" class returns 0 elements when I have in the Editor one DataSet loaded and activated? Is very strange.

Thank you very much in advance.

imageTracker.GetActiveDataSets() returns 0 elements

July 24, 2015 - 3:16am #5

Hello

You can only activate a dataset if the tracker is stopped.

Therefore you need to stop the tracker before activating a DataSet.

ObjectTracker imageTracker = (ImageTracker)TrackerManager.Instance.GetTracker<ObjectTracker>();
// Stop the tracker
oTracker.Stop ();
 
// ... Code for creating DataSet
// (Optional) Activate the data set.
oTracker.ActivateDataSet(currentDataSet);
 
// Start the tracker
oTracker.Start ();

 

Otherwise, the DataSet won't be part of the collection in the code

IEnumerable<DataSet> activeDataSets = oTracker.GetActiveDataSets();

 

imageTracker.GetActiveDataSets() returns 0 elements

January 23, 2014 - 6:32am #4

I think that perhaps you may be accessing it incorrectly?

Just now I was able to extend the Image Targets sample to enumerate through the list of active datasets by adding the method below to ImageTargetTrackableEventHandler.cs:

    void Update ()
    {
        ImageTracker imageTracker = TrackerManager.Instance.GetTracker<ImageTracker>();
        if (imageTracker != null)
        {
            IEnumerable<DataSetactiveDataSets = imageTracker.GetActiveDataSets();

            foreach (DataSet ds in activeDataSets) {

                Debug.Log("Active dataset = " + ds.Path);

            }

        }
    }

Remember that the IEnumerable  returns just an enumerator type in C#  http://msdn.microsoft.com/en-us/library/system.collections.ienumerable(v=vs.110).aspx

... which means that it in itself is not a list from which you can get a count.  Instead you get an enumerator which allows you to iterate through, and in the above example it simply prints the following:

"Active dataset = QCAR/StonesAndChips.xml"

 

HTH

N

 

imageTracker.GetActiveDataSets() returns 0 elements

January 23, 2014 - 4:55am #3

I'm developping and Android Unity application. It occurs in Play mode and device. In my case I have 3 DataSets loaded but only one activated. When I invoke "GetActiveDataSets()" from ImagetTracker, I get a IEnumerable that I convert into a list that contains 0 elements. How is it possible if I have in my Editor one activated DataSet

imageTracker.GetActiveDataSets() returns 0 elements

January 23, 2014 - 4:02am #2

Could you provide some more details of how to reproduce?

Is this native or Unity?

Play mode or device?

iOS or Android?

Can you demonstrate this with respect to any of the samples?

 

N

Log in or register to post comments