ImageTarget Class

Inherits: Target

Description

ImageTarget表示平面图像的target,它可以被 ImageTracker 所跟踪。

ImageTarget内的数值在可以被读取之前需要首先通过create...等方法填入。然后再通过 ImageTracker.loadTarget 成功载入 ImageTracker 之后可以被 ImageTracker 检测和跟踪。

Constructor

C

void easyar_ImageTarget__ctor(easyar_ImageTarget * * Return)

C++17

ImageTarget()

C++03(Deprecated)

ImageTarget()

Java

public ImageTarget()

Kotlin

constructor()

Objective-C

+ (easyar_ImageTarget *) create

Swift

public convenience init()

C#

public ImageTarget()

createFromParameters

从参数创建。

C

void easyar_ImageTarget_createFromParameters(easyar_ImageTargetParameters * parameters, easyar_OptionalOfImageTarget * Return)

C++17

static std::optional<std::shared_ptr<ImageTarget>> createFromParameters(std::shared_ptr<ImageTargetParameters> parameters)

C++03(Deprecated)

static void createFromParameters(ImageTargetParameters * parameters, ImageTarget * * Return)

Java

public static @Nullable ImageTarget createFromParameters(@Nonnull ImageTargetParameters parameters)

Kotlin

companion object fun createFromParameters(parameters: ImageTargetParameters): ImageTarget?

Objective-C

+ (easyar_ImageTarget *)createFromParameters:(easyar_ImageTargetParameters *)parameters

Swift

public static func createFromParameters(_ parameters: ImageTargetParameters) -> ImageTarget?

C#

public static Optional<ImageTarget> createFromParameters(ImageTargetParameters parameters)

createFromTargetFile

从etd文件创建。

C

void easyar_ImageTarget_createFromTargetFile(easyar_String * path, easyar_StorageType storageType, easyar_OptionalOfImageTarget * Return)

C++17

static std::optional<std::shared_ptr<ImageTarget>> createFromTargetFile(std::string path, StorageType storageType)

C++03(Deprecated)

static void createFromTargetFile(String * path, StorageType storageType, ImageTarget * * Return)

Java

public static @Nullable ImageTarget createFromTargetFile(java.lang.@Nonnull String path, int storageType)

Kotlin

companion object fun createFromTargetFile(path: String, storageType: Int): ImageTarget?

Objective-C

+ (easyar_ImageTarget *)createFromTargetFile:(NSString *)path storageType:(easyar_StorageType)storageType

Swift

public static func createFromTargetFile(_ path: String, _ storageType: StorageType) -> ImageTarget?

C#

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

createFromTargetData

从etd数据缓存创建。

C

void easyar_ImageTarget_createFromTargetData(easyar_Buffer * buffer, easyar_OptionalOfImageTarget * Return)

C++17

static std::optional<std::shared_ptr<ImageTarget>> createFromTargetData(std::shared_ptr<Buffer> buffer)

C++03(Deprecated)

static void createFromTargetData(Buffer * buffer, ImageTarget * * Return)

Java

public static @Nullable ImageTarget createFromTargetData(@Nonnull Buffer buffer)

Kotlin

companion object fun createFromTargetData(buffer: Buffer): ImageTarget?

Objective-C

+ (easyar_ImageTarget *)createFromTargetData:(easyar_Buffer *)buffer

Swift

public static func createFromTargetData(_ buffer: Buffer) -> ImageTarget?

C#

public static Optional<ImageTarget> createFromTargetData(Buffer buffer)

save

保存为etd文件。

C

bool easyar_ImageTarget_save(easyar_ImageTarget * This, easyar_String * path)

C++17

bool save(std::string path)

C++03(Deprecated)

bool save(String * path)

Java

public boolean save(java.lang.@Nonnull String path)

Kotlin

fun save(path: String): Boolean

Objective-C

- (bool)save:(NSString *)path

Swift

public func save(_ path: String) -> Bool

C#

public virtual bool save(string path)

createFromImageFile

从图像创建。如果不需要,name、uid、meta可以传空字符串,scale可以传默认值1。支持jpeg或png文件。

C

void easyar_ImageTarget_createFromImageFile(easyar_String * path, easyar_StorageType storageType, easyar_String * name, easyar_String * uid, easyar_String * meta, float scale, easyar_OptionalOfImageTarget * Return)

C++17

static std::optional<std::shared_ptr<ImageTarget>> createFromImageFile(std::string path, StorageType storageType, std::string name, std::string uid, std::string meta, float scale)

C++03(Deprecated)

static void createFromImageFile(String * path, StorageType storageType, String * name, String * uid, String * meta, float scale, ImageTarget * * Return)

Java

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)

Kotlin

companion object fun createFromImageFile(path: String, storageType: Int, name: String, uid: String, meta: String, scale: Float): ImageTarget?

Objective-C

+ (easyar_ImageTarget *)createFromImageFile:(NSString *)path storageType:(easyar_StorageType)storageType name:(NSString *)name uid:(NSString *)uid meta:(NSString *)meta scale:(float)scale

Swift

public static func createFromImageFile(_ path: String, _ storageType: StorageType, _ name: String, _ uid: String, _ meta: String, _ scale: Float) -> ImageTarget?

C#

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

scale

图像的缩放比例。其值为图像宽度的物理大小与1米的比值,默认值为1。

C

float easyar_ImageTarget_scale(const easyar_ImageTarget * This)

C++17

float scale()

C++03(Deprecated)

float scale()

Java

public float scale()

Kotlin

fun scale(): Float

Objective-C

- (float)scale

Swift

public func scale() -> Float

C#

public virtual float scale()

aspectRatio

图像的宽高比。

C

float easyar_ImageTarget_aspectRatio(const easyar_ImageTarget * This)

C++17

float aspectRatio()

C++03(Deprecated)

float aspectRatio()

Java

public float aspectRatio()

Kotlin

fun aspectRatio(): Float

Objective-C

- (float)aspectRatio

Swift

public func aspectRatio() -> Float

C#

public virtual float aspectRatio()

setScale

设置图像的缩放比例,设置之后会覆盖默认值以及在json文件中设的数值。其值为图像宽度的物理大小与1米的比值,默认值为1。

还需要在渲染引擎中单独设置此模型缩放。

C

bool easyar_ImageTarget_setScale(easyar_ImageTarget * This, float scale)

C++17

bool setScale(float scale)

C++03(Deprecated)

bool setScale(float scale)

Java

public boolean setScale(float scale)

Kotlin

fun setScale(scale: Float): Boolean

Objective-C

- (bool)setScale:(float)scale

Swift

public func setScale(_ scale: Float) -> Bool

C#

public virtual bool setScale(float scale)

images

获取target中存储的图像列表。通常这个方法用来获取云端返回的target的识别图数据。

C

void easyar_ImageTarget_images(easyar_ImageTarget * This, easyar_ListOfImage * * Return)

C++17

std::vector<std::shared_ptr<Image>> images()

C++03(Deprecated)

void images(ListOfImage * * Return)

Java

public java.util.@Nonnull ArrayList<@Nonnull Image> images()

Kotlin

fun images(): ArrayList<Image>

Objective-C

- (NSArray<easyar_Image *> *)images

Swift

public func images() -> [Image]

C#

public virtual List<Image> images()

runtimeID

获取target id。target id是运行时创建的整型数据,只有在成功的配置之后才是有效(非0)的。这个id是非0且全局递增的。

C

int easyar_ImageTarget_runtimeID(const easyar_ImageTarget * This)

C++17

int runtimeID()

C++03(Deprecated)

int runtimeID()

Java

public int runtimeID()

Kotlin

fun runtimeID(): Int

Objective-C

- (int)runtimeID

Swift

public override func runtimeID() -> Int32

C#

public override int runtimeID()

uid

获取target uid。ImageTarget的uid在云识别算法中使用。在没有接入云识别的时候,你可以在json配置中设置这个uid,在自己的代码中作为另一种区分target的方法。

C

void easyar_ImageTarget_uid(const easyar_ImageTarget * This, easyar_String * * Return)

C++17

std::string uid()

C++03(Deprecated)

void uid(String * * Return)

Java

public java.lang.@Nonnull String uid()

Kotlin

fun uid(): String

Objective-C

- (NSString *)uid

Swift

public override func uid() -> String

C#

public override string uid()

name

获取target名字。名字用来在json文件中区分target。

C

void easyar_ImageTarget_name(const easyar_ImageTarget * This, easyar_String * * Return)

C++17

std::string name()

C++03(Deprecated)

void name(String * * Return)

Java

public java.lang.@Nonnull String name()

Kotlin

fun name(): String

Objective-C

- (NSString *)name

Swift

public override func name() -> String

C#

public override string name()

setName

设置target名字。这个操作会覆盖上一次的设置或是服务器返回的数据。

C

void easyar_ImageTarget_setName(easyar_ImageTarget * This, easyar_String * name)

C++17

void setName(std::string name)

C++03(Deprecated)

void setName(String * name)

Java

public void setName(java.lang.@Nonnull String name)

Kotlin

fun setName(name: String): Unit

Objective-C

- (void)setName:(NSString *)name

Swift

public override func setName(_ name: String) -> Void

C#

public override void setName(string name)

meta

获取setMetaData所设置的meta data。或者在云识别返回的target中,获得服务器所设置的meta data。

C

void easyar_ImageTarget_meta(const easyar_ImageTarget * This, easyar_String * * Return)

C++17

std::string meta()

C++03(Deprecated)

void meta(String * * Return)

Java

public java.lang.@Nonnull String meta()

Kotlin

fun meta(): String

Objective-C

- (NSString *)meta

Swift

public override func meta() -> String

C#

public override string meta()

setMeta

设置meta data。这个操作会覆盖上一次的设置或是服务器返回的数据。

C

void easyar_ImageTarget_setMeta(easyar_ImageTarget * This, easyar_String * data)

C++17

void setMeta(std::string data)

C++03(Deprecated)

void setMeta(String * data)

Java

public void setMeta(java.lang.@Nonnull String data)

Kotlin

fun setMeta(data: String): Unit

Objective-C

- (void)setMeta:(NSString *)data

Swift

public override func setMeta(_ data: String) -> Void

C#

public override void setMeta(string data)