Skip to content

ImageTracker

A tracker that tracks images in a video. Images are tracked using templates known as reference images.

Instantiation

AR.Tracker.ImageTracker

AR.Tracker.ImageTracker(): ImageTracker

Instantiate an image tracker.

Returns

A new image tracker.

Example

const imageTracker = AR.Tracker.ImageTracker();

Properties

type

tracker.type: string, read-only

The string "image-tracker".

state

tracker.state: string, read-only

The current state of the tracker.

database

tracker.database: ReferenceImageDatabase, read-only

A database of reference images.

resolution

tracker.resolution: Resolution

The resolution adopted by the computer vision algorithms implemented in the tracker. Higher resolutions improve the tracking quality, but are computationally more expensive. Note that this resolution is different from, and should not be larger than, the resolution of the camera!

Events

An ImageTracker is an AREventTarget. You can listen to the following events:

targetfound

A target has been found.

Properties

  • referenceImage: ReferenceImage. The reference image that is linked to the target.

Example

tracker.addEventListener('targetfound', event => {
    console.log('Found target: ' + event.referenceImage.name);
});

targetlost

A target has been lost.

Properties

  • referenceImage: ReferenceImage. The reference image that is linked to the target.