ImageTarget Class

This type is an EasyAR Sense API in C#: ImageTarget . Some descriptions may not apply to Unity environment on this page.

This type is partially wrapped into Unity components: ImageTargetController . Members and instances of this type are not required to be used directly in most situations. Use this type by ImageTargetController.Target instead of creating new instances when a few unwrapped API is desired for use.

Description

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

The fields of ImageTarget need to be filled with the create… method before it can be read. And ImageTarget can be tracked by ImageTracker after a successful load into the ImageTracker using ImageTracker.loadTarget .


Methods

createFromParameters

C#

public static Optional<ImageTarget> createFromParameters( ImageTargetParameters parameters)

Creates a target from parameters.

createFromTargetFile

C#

public static Optional<ImageTarget> createFromTargetFile(string path, StorageType storageType)

Creates a target from an etd file.

createFromTargetData

C#

public static Optional<ImageTarget> createFromTargetData( Buffer buffer)

Creates a target from an etd data buffer.

save

C#

public virtual bool save(string path)

Saves as an etd file.

createFromImageFile

C#

public static Optional<ImageTarget> createFromImageFile(string path, StorageType storageType, string name, string uid, string meta, float scale)

Creates a target from an image file. If not needed, name, uid, meta can be passed with empty string, and scale can be passed with default value 1. Jpeg and png files are supported.

scale

C#

public virtual float scale()

The scale of image. The value is the physical image width divided by 1 meter. The default value is 1.

aspectRatio

C#

public virtual float aspectRatio()

The aspect ratio of image, width divided by height.

setScale

C#

public virtual bool setScale(float scale)

Sets image target scale, this will overwrite the value set in the json file or the default value. The value is the physical image width divided by 1 meter. The default value is 1.

It is needed to set the model scale in rendering engine separately.

images

C#

public virtual 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.

runtimeID

C#

public override int runtimeID()

Returns the target id. A target id is a integer number generated at runtime. This id is non-zero and increasing globally.

uid

C#

public override string uid()

Returns 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.

name

C#

public override string name()

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

setName

C#

public override void setName(string name)

Set name. It will erase previously set data or data from cloud.

meta

C#

public override string meta()

Returns the meta data set by setMetaData. Or, in a cloud returned target, returns the meta data set in the cloud server.

setMeta

C#

public override void setMeta(string data)

Set meta data. It will erase previously set data or data from cloud.