Learn how to use Augmented Images in your own apps.
Before following this guide, please refer to the Augmented Images overview for important considerations, practical tips and recommendations.
Build and run the sample app
Create a new project in Unity based on the quickstart.
When building the app, make sure to include the augmented image scene located in
Make sure your device is connected to your machine and then click Build and Run. Unity builds your project into an Android APK, installs it on the device, and launches it.
As you move your device, the app automatically detects and tracks images from the set of reference images located in
Create database file
In Project window, select your desired set of reference images (PNG or JPG), then right-click and select Create > Google ARCore > AugmentedImageDatabase.
A new image database is created in the same folder as the reference images.
The Inspector window displays the images in the database and the image quality score. The system may struggle to detect images with quality scores below 75.
You can optionally specify a physical width (in meters) for each image. If you do so, ARCore can estimate the pose of the physical image at runtime as soon as ARCore detects the physical image, without requiring the user to move the device to view the physical image from different viewpoints.
Use the database file
In the Project window, go to
In the Inspector, click the box next to Augmented Image Database and select the database file you created.
Get the AugmentedImage
AugmentedImageExampleController.cs, located in
Assets/GoogleARCore/Examples/AugmentedImage/Scripts, for an example on how to get the trackable:
Supporting different use cases
When ARCore detects an Augmented Image, it creates a
Trackable for that
Augmented Image and sets
FullTracking. When the tracked image
moves out of camera view, ARCore changes the
LastKnownPose while continuing to provide the orientation and position of
Your app should use these enumerators differently depending on the intended use case.
Fixed images. Most use cases involving images that are fixed in place (that is, not expected to move) can simply use
TrackingStateto determine whether the image has been detected and whether its location is known.
AugmentedImageTrackingMethodcan be ignored.
Moving images. If your app needs to track a moving image, use both
AugmentedImageTrackingMethodto determine whether the image has been detected and whether its position is known.
|Use case||Fixed image||Moving image|
|Example||A poster hung on a wall||An advertisement on the side of a bus|
|The pose can be
considered valid when