Table of Contents

Class ImageTarget

Namespace
easyar

ImageTarget represents a target for a planar image, which can be tracked by ImageTracker. Values inside ImageTarget must first be filled by methods such as create... before they can be read. After it is successfully loaded into ImageTracker through loadTarget, it can be detected and tracked by ImageTracker.

Inheritance
ImageTarget

Constructors

ImageTarget

void easyar_ImageTarget__ctor(easyar_ImageTarget * * Return)
ImageTarget()
public ImageTarget()
constructor()
+ (easyar_ImageTarget *) create
public convenience init()
public ImageTarget()

Methods

createFromParameters

Creates from parameters.

void easyar_ImageTarget_createFromParameters(easyar_ImageTargetParameters * parameters, easyar_OptionalOfImageTarget * Return)
static std::optional<std::shared_ptr<ImageTarget>> createFromParameters(std::shared_ptr<ImageTargetParameters> parameters)
public static @Nullable ImageTarget createFromParameters(@Nonnull ImageTargetParameters parameters)
companion object fun createFromParameters(parameters: ImageTargetParameters): ImageTarget?
+ (easyar_ImageTarget *)createFromParameters:(easyar_ImageTargetParameters *)parameters
public static func createFromParameters(_ parameters: ImageTargetParameters) -> ImageTarget?
public static Optional<ImageTarget> createFromParameters(ImageTargetParameters parameters)

Parameters

Name Type Description
parameters ImageTargetParameters

Returns

Type Description
Optional<ImageTarget>

createFromTargetFile

Creates from an etd file.

void easyar_ImageTarget_createFromTargetFile(easyar_String * path, easyar_StorageType storageType, easyar_OptionalOfImageTarget * Return)
static std::optional<std::shared_ptr<ImageTarget>> createFromTargetFile(std::string path, StorageType storageType)
public static @Nullable ImageTarget createFromTargetFile(java.lang.@Nonnull String path, int storageType)
companion object fun createFromTargetFile(path: String, storageType: Int): ImageTarget?
+ (easyar_ImageTarget *)createFromTargetFile:(NSString *)path storageType:(easyar_StorageType)storageType
public static func createFromTargetFile(_ path: String, _ storageType: StorageType) -> ImageTarget?
public static Optional<ImageTarget> createFromTargetFile(string path, StorageType storageType)

Parameters

Name Type Description
path String
storageType StorageType

Returns

Type Description
Optional<ImageTarget>

createFromTargetData

Creates from an etd data buffer.

void easyar_ImageTarget_createFromTargetData(easyar_Buffer * buffer, easyar_OptionalOfImageTarget * Return)
static std::optional<std::shared_ptr<ImageTarget>> createFromTargetData(std::shared_ptr<Buffer> buffer)
public static @Nullable ImageTarget createFromTargetData(@Nonnull Buffer buffer)
companion object fun createFromTargetData(buffer: Buffer): ImageTarget?
+ (easyar_ImageTarget *)createFromTargetData:(easyar_Buffer *)buffer
public static func createFromTargetData(_ buffer: Buffer) -> ImageTarget?
public static Optional<ImageTarget> createFromTargetData(Buffer buffer)

Parameters

Name Type Description
buffer Buffer

Returns

Type Description
Optional<ImageTarget>

save

Saves as an etd file.

bool easyar_ImageTarget_save(easyar_ImageTarget * This, easyar_String * path)
bool save(std::string path)
public boolean save(java.lang.@Nonnull String path)
fun save(path: String): Boolean
- (bool)save:(NSString *)path
public func save(_ path: String) -> Bool
public virtual bool save(string path)

Parameters

Name Type Description
path String

Returns

Type Description
Boolean

createFromImageFile

Creates from an image. If not needed, name, uid, and meta can be empty strings, and scale can use the default value 1. jpeg or png files are supported.

void easyar_ImageTarget_createFromImageFile(easyar_String * path, easyar_StorageType storageType, easyar_String * name, easyar_String * uid, easyar_String * meta, float scale, easyar_OptionalOfImageTarget * Return)
static std::optional<std::shared_ptr<ImageTarget>> createFromImageFile(std::string path, StorageType storageType, std::string name, std::string uid, std::string meta, float scale)
public static @Nullable ImageTarget createFromImageFile(java.lang.@Nonnull String path, int storageType, java.lang.@Nonnull String name, java.lang.@Nonnull String uid, java.lang.@Nonnull String meta, float scale)
companion object fun createFromImageFile(path: String, storageType: Int, name: String, uid: String, meta: String, scale: Float): ImageTarget?
+ (easyar_ImageTarget *)createFromImageFile:(NSString *)path storageType:(easyar_StorageType)storageType name:(NSString *)name uid:(NSString *)uid meta:(NSString *)meta scale:(float)scale
public static func createFromImageFile(_ path: String, _ storageType: StorageType, _ name: String, _ uid: String, _ meta: String, _ scale: Float) -> ImageTarget?
public static Optional<ImageTarget> createFromImageFile(string path, StorageType storageType, string name, string uid, string meta, float scale)

Parameters

Name Type Description
path String
storageType StorageType
name String
uid String
meta String
scale Single

Returns

Type Description
Optional<ImageTarget>

scale

Scale ratio of the image. Its value is the ratio between the physical size of the image width and 1 meter. The default value is 1.

float easyar_ImageTarget_scale(const easyar_ImageTarget * This)
float scale()
public float scale()
fun scale(): Float
- (float)scale
public func scale() -> Float
public virtual float scale()

Returns

Type Description
Single

aspectRatio

Aspect ratio of the image.

float easyar_ImageTarget_aspectRatio(const easyar_ImageTarget * This)
float aspectRatio()
public float aspectRatio()
fun aspectRatio(): Float
- (float)aspectRatio
public func aspectRatio() -> Float
public virtual float aspectRatio()

Returns

Type Description
Single

setScale

Sets the scale ratio of the image. After it is set, it overrides the default value and the value set in the json file. Its value is the ratio between the physical size of the image width and 1 meter. The default value is 1. This model scale also needs to be set separately in the rendering engine.

bool easyar_ImageTarget_setScale(easyar_ImageTarget * This, float scale)
bool setScale(float scale)
public boolean setScale(float scale)
fun setScale(scale: Float): Boolean
- (bool)setScale:(float)scale
public func setScale(_ scale: Float) -> Bool
public virtual bool setScale(float scale)

Parameters

Name Type Description
scale Single

Returns

Type Description
Boolean

images

Gets the list of images stored in the target. This method is usually used to get recognition images of a target returned from the cloud.

void easyar_ImageTarget_images(easyar_ImageTarget * This, easyar_ListOfImage * * Return)
std::vector<std::shared_ptr<Image>> images()
public java.util.@Nonnull ArrayList<@Nonnull Image> images()
fun images(): ArrayList<Image>
- (NSArray<easyar_Image *> *)images
public func images() -> [Image]
public virtual List<Image> images()

Returns

Type Description
List<Image>

runtimeID

Gets the target id. target id is integer data created at runtime and is valid (non-zero) only after successful configuration. This id is non-zero and globally incremental.

int easyar_ImageTarget_runtimeID(const easyar_ImageTarget * This)
int runtimeID()
public int runtimeID()
fun runtimeID(): Int
- (int)runtimeID
public override func runtimeID() -> Int32
public override int runtimeID()

Returns

Type Description
Int32

uid

Gets the target uid. The uid of ImageTarget is used in the cloud recognition algorithm. When cloud recognition is not integrated, you can set this uid in json configuration and use it in your own code as another way to distinguish targets.

void easyar_ImageTarget_uid(const easyar_ImageTarget * This, easyar_String * * Return)
std::string uid()
public java.lang.@Nonnull String uid()
fun uid(): String
- (NSString *)uid
public override func uid() -> String
public override string uid()

Returns

Type Description
String

name

Gets the target name. The name is used to distinguish targets in a json file.

void easyar_ImageTarget_name(const easyar_ImageTarget * This, easyar_String * * Return)
std::string name()
public java.lang.@Nonnull String name()
fun name(): String
- (NSString *)name
public override func name() -> String
public override string name()

Returns

Type Description
String

setName

Sets the target name. This operation overrides the previous setting or data returned by the server.

void easyar_ImageTarget_setName(easyar_ImageTarget * This, easyar_String * name)
void setName(std::string name)
public void setName(java.lang.@Nonnull String name)
fun setName(name: String): Unit
- (void)setName:(NSString *)name
public override func setName(_ name: String) -> Void
public override void setName(string name)

Parameters

Name Type Description
name String

Returns

Type Description
Void

meta

Gets the meta data set by setMetaData. Or, in a target returned by cloud recognition, gets the meta data set by the server.

void easyar_ImageTarget_meta(const easyar_ImageTarget * This, easyar_String * * Return)
std::string meta()
public java.lang.@Nonnull String meta()
fun meta(): String
- (NSString *)meta
public override func meta() -> String
public override string meta()

Returns

Type Description
String

setMeta

Sets meta data. This operation overrides the previous setting or data returned by the server.

void easyar_ImageTarget_setMeta(easyar_ImageTarget * This, easyar_String * data)
void setMeta(std::string data)
public void setMeta(java.lang.@Nonnull String data)
fun setMeta(data: String): Unit
- (void)setMeta:(NSString *)data
public override func setMeta(_ data: String) -> Void
public override void setMeta(string data)

Parameters

Name Type Description
data String

Returns

Type Description
Void