ImageTrackerBaseBehaviour Class

Inherits: DeviceUserAbstractBehaviour

Description

ImageTrackerBaseBehaviour is the component to control ImageTracker in the AR scene.

ImageTracker is used for image target detection and tracking. ImageTracker detects and tracks ImageTarget. You can call StartTrack/StopTrack to enable/disable the track process. StartTrack and StopTrack are very lightweight calls.

ImageTrackerBaseBehaviour should Bind to a DeviceAbstractBehaviour. This will be automatically done by the ARBuilder if you put ImageTrackerBaseBehaviour in the scene before everything start. If you add the component later in the scene, make sure to Bind it to a DeviceAbstractBehaviour, for example, Bind to a CameraDeviceBaseBehaviour.

An ImageTargetBaseBehaviour must be loaded into ImageTrackerBaseBehaviour before its target can be tracked using LoadImageTargetBehaviour explicitly or ImageTargetBaseBehaviour.Bind implicitly.

You will receive TargetAbstractBehaviour.TargetFound / TargetAbstractBehaviour.TargetLost and ARCameraBaseBehaviour.TargetFound / ARCameraBaseBehaviour.TargetLost events when a target is found or lost.

You can get a Frame from ARCameraBaseBehaviour.FrameUpdate which contains current camera image and tracked TargetInstance.

Public Properties

ImageTrackerMode Mode
List<ImageTargetBaseBehaviour> LoadedTargetBehaviours
int SimultaneousNum

Public Functions

void LoadImageTargetBehaviour(ImageTargetBaseBehaviour imageTargetBaseBehaviour)
void UnloadImageTargetBehaviour(ImageTargetBaseBehaviour imageTargetBaseBehaviour)
bool StartTrack()
bool StopTrack()

Public Events

event Action<ImageTrackerBaseBehaviour, ImageTargetBaseBehaviour, Target, bool> TargetLoad
event Action<ImageTrackerBaseBehaviour, ImageTargetBaseBehaviour, Target, bool> TargetUnload

Overwritten MonoBahaviour Functions

protected virtual void OnDestroy()
protected virtual void Start()
protected virtual void Update()

ImageTrackerMode Mode

(since 2.2.0) In 2.2.0, we enhanced the quality of tracking, but it may be slower and cost more energy on low-end phones. ImageTrackerMode.PreferQuality is the default mode. You can set the value to ImageTrackerMode.PreferPerformance in the editor or before start to keep a better performance with a little quality loss.

List<ImageTargetBaseBehaviour> LoadedTargetBehaviours

The ImageTargetBaseBehaviours currently loaded into the component.

int SimultaneousNum

The max number of targets which will be the simulatneously tracked by the tracker. The default value is 1.

void LoadImageTargetBehaviour(ImageTargetBaseBehaviour imageTargetBaseBehaviour)

Load the ImageTargetBaseBehaviour and its target into the component. Use this only if ImageTargetBaseBehaviour.Bind is not called. See ImageTargetBaseBehaviour.Bind for more details.

void UnloadImageTargetBehaviour(ImageTargetBaseBehaviour imageTargetBaseBehaviour)

Unload the ImageTargetBaseBehaviour and its target from the component.

bool StartTrack()

Starts the track algorithm. The track will start only after the behaviour is Bind to a DeviceAbstractBehaviour. This will be automatically done by the ARBuilder if you put ImageTrackerBaseBehaviour in the scene before everything start.

bool StopTrack()

Stops the track algorithm. Call StartTrack to start the track again.

event Action<ImageTrackerBaseBehaviour, ImageTargetBaseBehaviour, Target, bool> TargetLoad

The event for target load.

event Action<ImageTrackerBaseBehaviour, ImageTargetBaseBehaviour, Target, bool> TargetUnload

The event for target unload.