public class
AugmentedImageDatabase
Database containing a list of images to be detected and tracked by ARCore.
An image database supports up to 1000 images. A database can be generated by the
Only one image database can be active in a session. Any images in the currently active image database that have a TRACKING/PAUSED state will immediately be set to the STOPPED state if a different or null image database is made active in the current session Config.
Public Constructors
|
AugmentedImageDatabase(Session session)
Creates a new empty image database.
|
Public Methods
int
|
|
int
|
|
static
AugmentedImageDatabase
|
deserialize(Session session, InputStream inputStream)
Creates a new image database from an input stream.
|
int
|
getNumImages()
Returns the number of images in the database.
|
void
|
serialize(OutputStream outputStream)
Serializes the database to an OutputStream.
|
Inherited Methods
Public Constructors
public AugmentedImageDatabase (Session session)
AugmentedImageDatabase
public AugmentedImageDatabase( Session session )
Creates a new empty image database.
Details | |||
---|---|---|---|
Parameters |
|
Public Methods
public int addImage (String name, Bitmap bitmap)
addImage
public int addImage( String name, Bitmap bitmap )
Adds a single named image of unknown physical size to the augmented image database from an Android bitmap. Returns the zero-based positional index of the image within the database.
If the physical size of the image is known, use addImage(String, Bitmap, float)
instead, to improve image detection time.
For images added via this method, ARCore estimates the physical image's size and pose at runtime when the physical image is visible and is being tracked. This extra estimation step will require the user to move their device to view the physical image from different viewpoints before the size and pose of the physical image can be estimated.
This method takes time to perform non-trivial image processing (20ms - 30ms), and should be run on a background thread to avoid blocking the UI thread.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Throws |
|
public int addImage (String name, Bitmap bitmap, float widthInMeters)
addImage
public int addImage( String name, Bitmap bitmap, float widthInMeters )
Adds a single named image with known physical size to the augmented image database from an Android bitmap, with a specified physical width in meters. Returns the zero-based positional index of the image within the database.
If the physical size of the image is not known, use addImage(String, Bitmap)
instead, at the expense of an increased image detection time.
For images added via this method, 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. Note that ARCore will refine the estimated size and pose of the physical image as it is viewed from different viewpoints.
This method takes time to perform non-trivial image processing (20ms - 30ms), and should be run on a background thread to avoid blocking the UI thread.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Throws |
|
public static AugmentedImageDatabase deserialize (Session session, InputStream inputStream)
deserialize
public static AugmentedImageDatabase deserialize( Session session, InputStream inputStream )
Creates a new image database from an input stream. The stream contents must have been generated
by the command-line database generation tool provided in the SDK, or at runtime from serialize(OutputStream)
.
Note: this method takes about 10-20ms for a 5MB byte input stream. Run this in a background thread if this affects your application.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Throws |
|
public int getNumImages ()
getNumImages
public int getNumImages()
Returns the number of images in the database.
public void serialize (OutputStream outputStream)
serialize
public void serialize( OutputStream outputStream )
Serializes the database to an OutputStream.
Details | |||
---|---|---|---|
Parameters |
|
||
Throws |
|