API Reference

Class List

XrImageTracking

Image Tracking provides the ability to track real world images by provided image samples and their estimate sizes.

Summary

Properties

available

True if Image Tracking is available.

images

List of XrTrackedImage that contain tracking information.

supported

True if Image Tracking is supported.

Methods

add

Add an image for image tracking.

remove

Remove an image from image tracking.

Events

error

Fired when the XR session is started, but image tracking failed to process the provided images.

Details

Properties

booleanavailable

True if Image Tracking is available. This property will be false if no images were provided for the AR session or there was an error processing the provided images.

XrTrackedImage[]images

List of XrTrackedImage that contain tracking information.

booleansupported

True if Image Tracking is supported.

Methods

add(image, width)

Add an image for image tracking. A width can also be provided to help the underlying system estimate the appropriate transformation. Modifying the tracked images list is only possible before an AR session is started.

// image with width of 20cm (0.2m)
app.xr.imageTracking.add(bookCoverImg, 0.2);

Parameters

imageHTMLCanvasElement, HTMLImageElement, SVGImageElement, HTMLVideoElement, Blob, ImageData, ImageBitmap

Image that is matching real world image as close as possible. Resolution of images should be at least 300x300. High resolution does NOT improve tracking performance. Color of image is irrelevant, so greyscale images can be used. Images with too many geometric features or repeating patterns will reduce tracking stability.

widthnumber

Width (in meters) of image in the real world. Providing this value as close to the real value will improve tracking quality.

Returns

XrTrackedImage

Tracked image object that will contain tracking information.

remove(trackedImage)

Remove an image from image tracking.

Parameters

trackedImageXrTrackedImage

Tracked image to be removed. Modifying the tracked images list is only possible before an AR session is started.

Events

error

Fired when the XR session is started, but image tracking failed to process the provided images.

Parameters

errorError

Error object related to a failure of image tracking.