Create and Modify Targets in Native

An Image Target Observer can be created from a locally stored image file to instantly track an image in your AR application, all during application runtime.

Please refer to Image Targets API Overview for a general introduction to Image Targets. To create an Image Target from a file at runtime in Unity, refer to the article Instant Image Targets.

Applications usually use targets stored in a database. An application can use multiple Device Databases at the same time. Targets in databases that are created but not activated are not counted as active targets. See Detect and Track Multiple Targets Simultaneously for details on the number of supported targets active at a time and simultaneous tracking of targets.

An Image Target created at runtime from a file will not be subject to a star rating (as seen in the Target Manager) to indicate how well it tracks based on its features. You should, therefore, ensure that the image's content falls within the ideal attributes of an Image Target. See VuImageTargetFileConfig for details on the supported maximum pixel size,

Create Image Targets from Image Files

To create an Image Target Observer directly from an image file at runtime, the path must be directed to the locally stored file on the device.

The following example allows you to retrieve an image file from a local storage and attach it to a VuImageTargetFileConfig. Hereafter, the runtime image can be loaded into an empty database.

VuObserver* observer = nullptr;

// Create an observer from a filepath
VuImageTargetFileConfig imageTargetFileConfig = vuImageTargetFileConfigDefault();
imageTargetFileConfig.path = “filePath”;
imageTargetFileConfig.targetWidth = 0.4f;
imageTargetFileConfig.targetName = “mTarget”;

VuImageTargetFileCreationError creationError;
vuEngineCreateImageTargetObserverFromFileConfig(mEngine, &observer, &imageTargetFileConfig, &creationError);

NOTE: alternatively, use VuImageTargetBufferConfig and vuEngineCreateImageTargetObserverFromBufferConfig instead if it is a pixel buffer that contains the image.

Can this page be better?
Share your feedback via our issue tracker