A container of data for one or more Trackable instances.
A DataSet stores data for one or more ObjectTarget-derived Trackables (for a full list of applicable types, refer to the inheritance tree diagram for ObjectTarget).
Typically, you obtain an empty DataSet instance from ObjectTracker::createDataSet(). Populate the returned DataSet either using load() with data prepared offline (pairs of .xml and .dat files), or using createTrackable() with data provided at runtime (for example from a camera frame). Once populated, activate the DataSet using ObjectTracker::activateDataSet().
It is not possible to modify a DataSet, nor any of the Trackables which rely on it, while the DataSet is active.
To modify an active DataSet (e.g. via calls to load(), createTrackable(), destroy()) or to make changes to a Trackable which uses it, you need to do the following:
To destroy the DataSet once it is no longer needed, call ObjectTracker::deactivateDataSet() followed by ObjectTracker::destroyDataSet().
Public Member Functions | |
virtual bool | load (const char *path, STORAGE_TYPE storageType)=0 |
Load dataset data from storage media. More... | |
virtual List< Trackable > | getTrackables ()=0 |
Returns a list of trackable objects in this data set. More... | |
virtual Trackable * | createTrackable (const TrackableSource *source)=0 |
Create a Trackable from the given TrackableSource and register it with this DataSet. More... | |
virtual Trackable * | createTrackable (const RuntimeImageSource *source)=0 |
Create a Trackable from the given RuntimeImageSource and register it with this DataSet. More... | |
virtual MultiTarget * | createMultiTarget (const char *name)=0 |
Create a new MultiTarget and register it with this DataSet. More... | |
virtual bool | destroy (Trackable *trackable)=0 |
Destroy a Trackable. More... | |
virtual bool | hasReachedTrackableLimit ()=0 |
Check if this DataSet's Trackable capacity is reached. More... | |
virtual bool | isActive () const =0 |
Check if this dataset is active. More... | |
virtual | ~DataSet () |
Static Public Member Functions | |
static bool | exists (const char *path, STORAGE_TYPE storageType) |
Check if a given data set exists on storage media. More... | |
|
inlinevirtual |
|
static |
Check if a given data set exists on storage media.
A data set on permanent storage media consists of an .xml file and a .dat file, sharing the same file name, in the same folder. This function checks for the existence of a data set that matches this pattern, given an .xml file and a path type.
path | Path and filename of the .xml file. Path handling is controlled by storageType. |
storageType | Controls how path to the .xml file should be handled. |
|
pure virtual |
Load dataset data from storage media.
During a successful load, one or more Trackable objects will be created from the loaded data. These Trackables can be accessed via getTrackables().
Note that loading of data sets may take a significant amount of time, and it is therefore recommended to do this on a background thread.
This method cannot be used while the DataSet is active.
load() can only be called once on a DataSet. Subsequent calls to load() will remove any existing data and replace it with the newly-loaded data.
path | Path and filename of the .xml file. Path handling is controlled by storageType. |
storageType | Controls how the path to the .xml file should be handled. |
Returns a list of trackable objects in this data set.
Trackables that are part of other trackables (e.g. an ImageTarget that is part of a MultiTarget) are not delivered by this method. Such trackables can be accesses via the trackable they are part of. E.g. use MultiTarget::getParts() to access the respective ImageTargets.
|
pure virtual |
Create a Trackable from the given TrackableSource and register it with this DataSet.
This method can be used to create a new Trackable based on source data acquired at runtime, such as a camera frame (see ImageTargetBuilder for more information.)
The returned Trackable will also be included in future calls getTrackables() (unless it is made part of MultiTarget), until either it is destroyed by a call to Destroy(), or the DataSet itself is destroyed via ObjectTracker::destroyDataSet().
This method cannot be used while the DataSet is active.
source | The TrackableSource to use when creating the new Trackable. |
|
pure virtual |
Create a Trackable from the given RuntimeImageSource and register it with this DataSet.
This method can be used to create a new Trackable based on source data acquired at runtime, such as an image file loaded externally or provided by third party source (see RuntimeImageSource).
The returned Trackable will also be included in future calls getTrackables() (unless it is made part of MultiTarget), until either it is destroyed by a call to Destroy(), or the DataSet itself is destroyed via ObjectTracker::destroyDataSet().
This method cannot be used while the DataSet is active.
source | The RuntimeImageSource to use when creating the new Trackable. |
|
pure virtual |
Create a new MultiTarget and register it with this DataSet.
The returned MultiTarget is owned by this DataSet. It will be included in future calls to getNumTrackables() and getTrackable(), until either it is destroyed by a call to Destroy(), or the DataSet itself is destroyed via ObjectTracker::destroyDataSet().
This method cannot be used while the DataSet is active.
name | A name for the new MultiTarget |
|
pure virtual |
|
pure virtual |
Check if this DataSet's Trackable capacity is reached.
Each DataSet has a limited number for Trackable instances that it can hold. Use this method to check if this DataSet's capacity has been reached.
For example, if you are creating ImageTargets based on camera frames captured at runtime, you can check this method before calling createTrackable(). If it returns true, you might want to destroy the oldest ImageTarget first, or ask the user what to do.
|
pure virtual |
Check if this dataset is active.
A DataSet is only usable by a Tracker when it is active, but an active DataSet cannot be modified.
To activate a DataSet, call ObjectTracker::activateDataSet(). To deactivate a DataSet, call ObjectTracker::deactivateDataSet().