ImageTarget Class

Inherits:  [Target][0]

Description

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

The size of ImageTarget is set in json which will be loaded in the Load/LoadImage/LoadJsonFile/LoadJsonString method or calculated from image resolution automatically if not provided.

A ImageTarget should be loaded using Load/LoadImage/LoadJsonFile/LoadJsonString before any value is valid. And ImageTarget can be tracked by ImageTracker after a successful load into the ImageTracker using ImageTracker.LoadTarget or ImageTracker.LoadTargetBlocked.

Public Properties

Vector2 | Size

Public Functions

ImageTarget()
bool LoadImage(string path, StorageType storageType, string targetname, Vector2 size)
bool LoadJsonFile(string path, StorageType storageType, string targetname)
bool LoadJsonString(string json, StorageType storageType, string targetname)
static List LoadListFromJsonFile(string path, StorageType storageType)(since 1.3.0)
static List LoadListFromJsonString(string json, StorageType storageType)(since 1.3.0)

Protected Functions

bool Load(string path, int storageType, string name)
static List LoadList(string path, int storageType)(since 1.3.0)

ImageTarget()

Creates a ImageTarget object.

Vector2 Size

Size of the image target. It is only valid (non-zero) after a successful load into the ImageTracker using ImageTracker.LoadTarget or ImageTracker.LoadTargetBlocked, or set manually using this property.

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 ImageTracker.LoadTarget or ImageTracker.LoadTargetBlocked. 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.

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.

bool LoadImage(string path, StorageType storageType, string targetname, Vector2 size)

Load an image. This method only parses the configurations.

Load an image from path with storageType, and set the target name to targetname and set the target size to size.

storageType should be StorageType.App or StorageType.Assets or StorageType.Absolute indicating the path type.

See StorageType for more descriptions of StorageType.

bool LoadJsonFile(string path, StorageType storageType, string targetname)

Load a json file. This method only parses the json file.

Load named target if name is not empty, otherwise load the first target.

StorageType should be StorageType.App or StorageType.Assets or StorageType.Absolute indicating the path type. Paths inside json files should be absolute path or relative path to the json file.

See StorageType for more descriptions of StorageType.

bool LoadJsonString(string json, StorageType storageType, string targetname)

Load a json string. This method only parses the json string.

Load named target if name is not empty, otherwise load the first target.

StorageType should be StorageType.App or StorageType.Assets or StorageType.Absolute indicating the path type. Paths inside json string should be absolute path or relative path to the storageType root.

See StorageType for more descriptions of StorageType.

bool Load(string path, int storageType, string name)

Load a json file or json string. This method only parses the json file or string.

Load named target if name is not empty, otherwise load the first target.

If path is json file path, storageType should be StorageType.App or StorageType.Assets or StorageType.Absolute indicating the path type. Paths inside json files should be absolute path or relative path to the json file.

If path is json string, storageType should be (StorageType.App | StorageType.Json) or (StorageType.Assets | StorageType.Json) or ( StorageType.Absolute | StorageType.Json). Paths inside json string should be absolute path or relative path to the storageType root.

See StorageType for more descriptions of StorageType.

static List LoadListFromJsonFile(string path, StorageType storageType)(since 1.3.0)

Loads all targets listed in the json file from path with storageType. See Load and StorageType for more descriptions of storageType and json file.

static List LoadListFromJsonString(string json, StorageType storageType)(since 1.3.0)

Loads all targets listed in the json string json with storageType. See Load and StorageType for more descriptions of storageType and json file.

static List LoadList(string path, int storageType)(since 1.3.0)

Loads all targets listed in the json file or json string from path with storageType. See Load and StorageType for more descriptions of storageType and json file.

results matching ""

    No results matching ""