ImageTarget Class

Inherits: Base

Description

ImageTarget represents planer image targets that can be tracked by ImageTrackerBaseBehaviour.

The size of ImageTarget is set in json or input parameters which will be loaded in the SetupWithImage/SetupWithJsonFile/SetupWithJsonString/SetupWithTarget method of ImageTargetBaseBehaviour or calculated from image resolution automatically if not provided.

ImageTarget can be tracked by ImageTrackerBaseBehaviour after a successful load into the ImageTrackerBaseBehaviour explicitly using ImageTrackerBaseBehaviour.LoadImageTargetBehaviour or implicitly using ImageTargetBaseBehaviour.Bind. ImageTrackerBaseBehaviour.TargetLoad and ImageTargetBaseBehaviour.TargetLoad event will be triggered after load.

Public Properties

int Id
string MetaData
string Name
string Uid
List<Image> Images
Vector2 Size
Target Target

Public Functions

static ImageTarget FromTarget(Target target)

int Id

The target id. A target id is a int number generated at runtime, it is valid (non-zero) only after a successful setup.

string Uid

The target uid. A target uid is useful in cloud based algorithms. If no cloud is used, you can set this uid in the json config as an alternative method to distinguish from targets.

string Name

The target name. Name is used to distinguish targets in a json file.

string MetaData

The meta data. In a cloud returned target, the meta data is pre-set in the cloud server.

A set operation will set the data as string. It will erase previously set data or data from cloud.

List<Image> Images

Returns a list of images that stored in the target. It is generally used to get image data from cloud returned target.

Vector2 Size

Size of the ImageTarget. It is only valid (non-zero) after a successful load into the ImageTrackerBaseBehaviour explicitly using ImageTrackerBaseBehaviour.LoadImageTargetBehaviour or implicitly using ImageTargetBaseBehaviour.Bind, or set manually using this property. ImageTrackerBaseBehaviour.TargetLoad and ImageTargetBaseBehaviour.TargetLoad event will be triggered after load.

If a size is not set, the default size calculated from image resolution will be returned.

The set operation will overwrite the value set in the json file or the default value.

The value will be recalculated from image resolution after load. After calculation, the max value of size will be kept, and the other dimension will be updated from the resolution. Make sure to query size after a successfully load of target from ImageTrackerBaseBehaviour.TargetLoad or ImageTargetBaseBehaviour.TargetLoad event handler.

When the size is set to have the same aspect ratio as image resolution, it will make no difference after recalculation and the size will not actually change.

Target Target

Convert to Target.

static ImageTarget FromTarget(Target target)

Convert Target to ImageTarget.