Target Class

Inherits: Base

Inherited By: ImageTarget

Description

Target is the base class for all targets that can be tracked by ImageTracker or other algorithms inside EasyAR.

A target should be loaded before any value is valid.

Public Properties

int Id
string MetaData
string Name
string Uid
List<Image> Images

Public Functions

Target()
static List<Target> LoadListFromJsonFile(string path, StorageType storageType) (until 1.2.1)
static List<Target> LoadListFromJsonString(string json, StorageType storageType) (until1.2.1)

Protected Functions

bool Load(string path, int storageType, string name)
static List<Target> LoadList(string path, int storageType) (until 1.2.1)

Target()

Creates a Target object.

int Id

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

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 a alternative method to distinguish from targets.

string Name

The target name. Name is used to distinguish targets in a json file. see Load for more details.

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.

static List<Target> LoadListFromJsonFile(string path, StorageType storageType) (until 1.2.1)

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<Target> LoadListFromJsonString(string json, StorageType storageType) (until 1.2.1)

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

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

Load a json file or json string. The implement of this method is empty, you should use it from a derived class.

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<Target> LoadList(string path, int storageType) (until 1.2.1)

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.