addAugmentedImage

fun Config.addAugmentedImage(session: Session, name: String, bitmap: Bitmap, widthInMeters: Float? = null)

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.

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.

Parameters

name

Name metadata for this image, does not have to be unique.

bitmap

Bitmap containing the image in ARGB_8888 format. The alpha channel is ignored in this bitmap, as only non-transparent images are currently supported.

widthInMeters

Width in meters for this image, must be strictly greater than zero. null indicates the physical size of the image is not known, at the expense of an increased image detection time.

Throws

ImageInsufficientQualityException

if the image quality is image is insufficient, e.g. if the image has not enough features.

if the bitmap is not in ARGB_888 format or the width in meters is less than or equal to zero.