Class ObjectTarget
- Namespace
- easyar
- Assembly
- EasyAR.Sense.dll
ObjectTarget represents a 3D object target, which can be tracked by `ObjectTracker`_ The size of ObjectTarget is determined by the `obj` file. You can modify the size by changing the `scale`. The default value of `scale` is 1. After ObjectTarget is successfully loaded into `ObjectTracker` via `ObjectTracker.loadTarget`, it can be detected and tracked by `ObjectTracker`
public class ObjectTarget : Target, IDisposable
- Inheritance
-
ObjectTarget
- Implements
- Inherited Members
Constructors
ObjectTarget()
public ObjectTarget()
Methods
Clone()
public ObjectTarget Clone()
Returns
CloneObject()
protected override object CloneObject()
Returns
boundingBox()
The bounding box of the object, including 8 vertices of the box. The vertex index is defined as follows: ::
4-----7
/| /|
5-----6 | z
| | | | |
| 0---|-3 o---y
|/ |/ /
1-----2 x
</p>
public virtual List<Vec3F> boundingBox()
Returns
createFromObjectFile(string, StorageType, string, string, string, float)
Create from obj, mtl and jpg/png files.
public static Optional<ObjectTarget> createFromObjectFile(string path, StorageType storageType, string name, string uid, string meta, float scale)
Parameters
pathstorageTypenameuidmetascale
Returns
createFromParameters(ObjectTargetParameters)
Create from parameters.
public static Optional<ObjectTarget> createFromParameters(ObjectTargetParameters parameters)
Parameters
parameters
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
scale()
The scaling factor of the model. It is the ratio of the physical size of the model in space to the size in the model coordinate system, with a default value of 1. (Assume that the scale unit in the model coordinate system is meters)
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 scaling factor of the model. After setting, it will overwrite the default value and the value set in the json file. It is the ratio of the physical size of the model in space to the size in the model coordinate system, with a default value of 1. (Assume that the scale unit in the model coordinate system is meters) You also need to set the model scaling separately in the rendering engine. Note that this setting needs to be done before loading `ObjectTracker` via `ObjectTracker.loadTarget`
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()