Class ImageTarget
- Namespace
- easyar
- Assembly
- EasyAR.Sense.dll
ImageTarget represents the target of a planar image, which can be tracked by `ImageTracker`_. The values in ImageTarget need to be filled in first through methods like create... before they can be read. Then, after successfully loading `ImageTracker`_ through `ImageTracker.loadTarget`, it can be detected and tracked by `ImageTracker`_.
public class ImageTarget : Target, IDisposable
- Inheritance
-
ImageTarget
- Implements
- Inherited Members
Constructors
ImageTarget()
public ImageTarget()
Methods
Clone()
public ImageTarget Clone()
Returns
CloneObject()
protected override object CloneObject()
Returns
aspectRatio()
The aspect ratio of the image.
public virtual float aspectRatio()
Returns
createFromImageFile(string, StorageType, string, string, string, float)
Create from image. If not needed, name, uid, meta can be passed as empty strings, and scale can be passed as the default value 1. Supports jpeg or png files.
public static Optional<ImageTarget> createFromImageFile(string path, StorageType storageType, string name, string uid, string meta, float scale)
Parameters
pathstorageTypenameuidmetascale
Returns
createFromParameters(ImageTargetParameters)
Create from parameters.
public static Optional<ImageTarget> createFromParameters(ImageTargetParameters parameters)
Parameters
parameters
Returns
createFromTargetData(Buffer)
Create from etd data cache.
public static Optional<ImageTarget> createFromTargetData(Buffer buffer)
Parameters
buffer
Returns
createFromTargetFile(string, StorageType)
Create from etd file.
public static Optional<ImageTarget> createFromTargetFile(string path, StorageType storageType)
Parameters
pathstorageType
Returns
images()
Get the list of images stored in the target. Usually, this method is used to obtain the recognition image data of the target returned from the cloud.
public virtual List<Image> images()
Returns
meta()
Get the meta data set by setMetaData. Or, in the target returned by cloud recognition, obtain the meta data set by the server.
public override string meta()
Returns
name()
Get the target name. The name is used to distinguish targets in the json file.
public override string name()
Returns
runtimeID()
Get the target id. The target id is an integer data created at runtime and is valid (non-zero) only after successful configuration. This id is non-zero and globally increasing.
public override int runtimeID()
Returns
save(string)
Save as etd file.
public virtual bool save(string path)
Parameters
path
Returns
scale()
The scale of the image. Its value is the ratio of the physical size of the image width to 1 meter, with a default value of 1.
public virtual float scale()
Returns
setMeta(string)
Set meta data. This operation will overwrite the previous setting or the data returned by the server.
public override void setMeta(string data)
Parameters
data
setName(string)
Set the target name. This operation will overwrite the previous setting or the data returned by the server.
public override void setName(string name)
Parameters
name
setScale(float)
Set the scale of the image. After setting, it will overwrite the default value and the value set in the json file. Its value is the ratio of the physical size of the image width to 1 meter, with a default value of 1. Also, this model scale needs to be set separately in the rendering engine.
public virtual bool setScale(float scale)
Parameters
scale
Returns
uid()
Get the target uid. The uid of ImageTarget is used in the cloud recognition algorithm. When not accessing cloud recognition, you can set this uid in the json configuration and use it as another way to distinguish targets in your own code.
public override string uid()