ImageTarget Class

Inherits: Target

Description

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

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

Constructor

C: void easyar_ImageTarget__ctor(easyar_ImageTarget * * Return)
C++17: ImageTarget()
Traditional C++: ImageTarget()
Java: public ImageTarget()
Kotlin: constructor()
Objective-C: + (easyar_ImageTarget *) create
Swift: public convenience init()
C#: public ImageTarget()

createFromParameters

Creates a target from parameters.

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)
Traditional C++: 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

Creates a target from an etd file.

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)
Traditional C++: 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

Creates a target from an etd data buffer.

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)
Traditional C++: 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

Saves as an etd file.

C: bool easyar_ImageTarget_save(easyar_ImageTarget * This, easyar_String * path)
C++17: bool save(std::string path)
Traditional C++: 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

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.

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)
Traditional C++: 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)

setupAll

Setup all targets listed in the json file or json string from path with storageType. This method only parses the json file or string.

If path is json file path, storageType should be App or Assets or Absolute indicating the path type. Paths inside json files should be absolute path or relative path to the json file.

See StorageType for more descriptions.

C: void easyar_ImageTarget_setupAll(easyar_String * path, easyar_StorageType storageType, easyar_ListOfImageTarget * * Return)
C++17: static std::vector<std::shared_ptr<ImageTarget>> setupAll(std::string path, StorageType storageType)
Traditional C++: static void setupAll(String * path, StorageType storageType, ListOfImageTarget * * Return)
Java: public static java.util.@Nonnull ArrayList<@Nonnull ImageTarget> setupAll(java.lang.@Nonnull String path, int storageType)
Kotlin: companion object fun setupAll(path: String, storageType: Int): ArrayList<ImageTarget>
Objective-C: + (NSArray<easyar_ImageTarget *> *)setupAll:(NSString *)path storageType:(easyar_StorageType)storageType
Swift: public static func setupAll(_ path: String, _ storageType: StorageType) -> [ImageTarget]
C#: public static List<ImageTarget> setupAll(string path, StorageType storageType)

scale

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

C: float easyar_ImageTarget_scale(const easyar_ImageTarget * This)
C++17: float scale()
Traditional C++: 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

The aspect ratio of image, width divided by height.

C: float easyar_ImageTarget_aspectRatio(const easyar_ImageTarget * This)
C++17: float aspectRatio()
Traditional C++: 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

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.

C: bool easyar_ImageTarget_setScale(easyar_ImageTarget * This, float scale)
C++17: bool setScale(float scale)
Traditional C++: 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

Returns a list of images that stored in the target. It is generally used to get image data from cloud returned target.

C: void easyar_ImageTarget_images(easyar_ImageTarget * This, easyar_ListOfImage * * Return)
C++17: std::vector<std::shared_ptr<Image>> images()
Traditional C++: 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

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

C: int easyar_ImageTarget_runtimeID(const easyar_ImageTarget * This)
C++17: int runtimeID()
Traditional C++: 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

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.

C: void easyar_ImageTarget_uid(const easyar_ImageTarget * This, easyar_String * * Return)
C++17: std::string uid()
Traditional C++: 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

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

C: void easyar_ImageTarget_name(const easyar_ImageTarget * This, easyar_String * * Return)
C++17: std::string name()
Traditional C++: 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

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

C: void easyar_ImageTarget_setName(easyar_ImageTarget * This, easyar_String * name)
C++17: void setName(std::string name)
Traditional C++: 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

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

C: void easyar_ImageTarget_meta(const easyar_ImageTarget * This, easyar_String * * Return)
C++17: std::string meta()
Traditional C++: 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

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

C: void easyar_ImageTarget_setMeta(easyar_ImageTarget * This, easyar_String * data)
C++17: void setMeta(std::string data)
Traditional C++: 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)