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 please refer to the article Instant Image Targets page.
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 supported active targets 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 content of the image fall within the ideal attributes of an Image Target.
To create an Image Target Observer directly from an image file at runtime the file path must be directed to 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
vuEngineCreateImageTargetObserverFromBufferConfig instead if it is a pixel buffer that contains the image.