CloudRecognizer Class

Description

CloudRecognizer implements cloud recognition. It can only be used after created a recognition image library on the cloud. Please refer to EasyAR CRS documentation.

CloudRecognizer occupies one buffer of camera. Use setBufferCapacity of camera to set an amount of buffers that is not less than the sum of amount of buffers occupied by all components. Refer to Overview _ .

After creation, you can call start/stop to enable/disable running.

When the component is not needed anymore, call close function to close it. It shall not be used after calling close.

CloudRecognizer inputs InputFrame from inputFrameSink. InputFrameSource shall be connected to inputFrameSink for use. Refer to Overview _ .

Before using a CloudRecognizer, an ImageTracker must be setup and prepared. Any target returned from cloud should be manually put into the ImageTracker using ImageTracker.loadTarget if it need to be tracked. Then the target can be used as same as a local target after loaded into the tracker. When a target is recognized, you can get it from callback, and you should use target uid to distinguish different targets. The target runtimeID is dynamically created and cannot be used as unique identifier in the cloud situation.

isAvailable

Returns true.

C: bool easyar_CloudRecognizer_isAvailable(void)
C++17: static bool isAvailable()
Traditional C++: static bool isAvailable()
Java: public static boolean isAvailable()
Kotlin: companion object fun isAvailable(): Boolean
Objective-C: + (bool)isAvailable
Swift: public static func isAvailable() -> Bool
C#: public static bool isAvailable()

inputFrameSink

InputFrame input port. Raw image and timestamp are essential.

C: void easyar_CloudRecognizer_inputFrameSink(easyar_CloudRecognizer * This, easyar_InputFrameSink * * Return)
C++17: std::shared_ptr<InputFrameSink> inputFrameSink()
Traditional C++: void inputFrameSink(InputFrameSink * * Return)
Java: public @Nonnull InputFrameSink inputFrameSink()
Kotlin: fun inputFrameSink(): InputFrameSink
Objective-C: - (easyar_InputFrameSink *)inputFrameSink
Swift: public func inputFrameSink() -> InputFrameSink
C#: public virtual InputFrameSink inputFrameSink()

bufferRequirement

Camera buffers occupied in this component.

C: int easyar_CloudRecognizer_bufferRequirement(easyar_CloudRecognizer * This)
C++17: int bufferRequirement()
Traditional C++: int bufferRequirement()
Java: public int bufferRequirement()
Kotlin: fun bufferRequirement(): Int
Objective-C: - (int)bufferRequirement
Swift: public func bufferRequirement() -> Int32
C#: public virtual int bufferRequirement()

create

Creates an instance and connects to the server.

C: void easyar_CloudRecognizer_create(easyar_String * cloudRecognitionServiceServerAddress, easyar_String * apiKey, easyar_String * apiSecret, easyar_String * cloudRecognitionServiceAppId, easyar_CallbackScheduler * callbackScheduler, easyar_OptionalOfFunctorOfVoidFromCloudStatusAndListOfTarget callback, easyar_CloudRecognizer * * Return)
C++17: static std::shared_ptr<CloudRecognizer> create(std::string cloudRecognitionServiceServerAddress, std::string apiKey, std::string apiSecret, std::string cloudRecognitionServiceAppId, std::shared_ptr<CallbackScheduler> callbackScheduler, std::optional<std::function<void(CloudStatus, std::vector<std::shared_ptr<Target>>)>> callback)
Traditional C++: static void create(String * cloudRecognitionServiceServerAddress, String * apiKey, String * apiSecret, String * cloudRecognitionServiceAppId, CallbackScheduler * callbackScheduler, OptionalOfFunctorOfVoidFromCloudStatusAndListOfTarget callback, CloudRecognizer * * Return)
Java: public static @Nonnull CloudRecognizer create(java.lang.@Nonnull String cloudRecognitionServiceServerAddress, java.lang.@Nonnull String apiKey, java.lang.@Nonnull String apiSecret, java.lang.@Nonnull String cloudRecognitionServiceAppId, @Nonnull CallbackScheduler callbackScheduler, @Nullable FunctorOfVoidFromCloudStatusAndListOfTarget callback)
Kotlin: companion object fun create(cloudRecognitionServiceServerAddress: String, apiKey: String, apiSecret: String, cloudRecognitionServiceAppId: String, callbackScheduler: CallbackScheduler, callback: FunctorOfVoidFromCloudStatusAndListOfTarget?): CloudRecognizer
Objective-C: + (easyar_CloudRecognizer *)create:(NSString *)cloudRecognitionServiceServerAddress apiKey:(NSString *)apiKey apiSecret:(NSString *)apiSecret cloudRecognitionServiceAppId:(NSString *)cloudRecognitionServiceAppId callbackScheduler:(easyar_CallbackScheduler *)callbackScheduler callback:(void (^)(easyar_CloudStatus status, NSArray<easyar_Target *> * targets))callback
Swift: public static func create(_ cloudRecognitionServiceServerAddress: String, _ apiKey: String, _ apiSecret: String, _ cloudRecognitionServiceAppId: String, _ callbackScheduler: CallbackScheduler, _ callback: ((CloudStatus, [Target]) -> Void)?) -> CloudRecognizer
C#: public static CloudRecognizer create(string cloudRecognitionServiceServerAddress, string apiKey, string apiSecret, string cloudRecognitionServiceAppId, CallbackScheduler callbackScheduler, Optional<Action<CloudStatus, List<Target>>> callback)

start

Starts the recognition.

C: bool easyar_CloudRecognizer_start(easyar_CloudRecognizer * This)
C++17: bool start()
Traditional C++: bool start()
Java: public boolean start()
Kotlin: fun start(): Boolean
Objective-C: - (bool)start
Swift: public func start() -> Bool
C#: public virtual bool start()

stop

Stops the recognition.

C: void easyar_CloudRecognizer_stop(easyar_CloudRecognizer * This)
C++17: void stop()
Traditional C++: void stop()
Java: public void stop()
Kotlin: fun stop(): Unit
Objective-C: - (void)stop
Swift: public func stop() -> Void
C#: public virtual void stop()

close

Stops the recognition and closes connection. The component shall not be used after calling close.

C: void easyar_CloudRecognizer_close(easyar_CloudRecognizer * This)
C++17: void close()
Traditional C++: void close()
Java: public void close()
Kotlin: fun close(): Unit
Objective-C: - (void)close
Swift: public func close() -> Void
C#: public virtual void close()