pc.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 pc.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
Constructor
XrImageTracking(manager)
Image Tracking provides the ability to track real world images by provided image samples and their estimate sizes.
Parameters
manager | pc.XrManager | WebXR Manager. |
Properties
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.
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
image | HTMLCanvasElement, 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. |
width | number | Width (in meters) of image in the real world. Providing this value as close to the real value will improve tracking quality. |
Returns
pc.XrTrackedImageTracked image object that will contain tracking information.
remove(trackedImage)
Remove an image from image tracking.
Parameters
trackedImage | pc.XrTrackedImage | Tracked image to be removed. Modifying the tracked images list is only possible before an AR session is started. |