CloudRecognizer Class

Inherits: FrameFilter

Description

CloudRecognizer is the class for cloud recognition.

A CloudRecognizer works on its own thread. You need to call attachStreamer to attach a FrameStreamer to CloudRecognizer first, then the images from the FrameStreamer are used for cloud recognition by the CloudRecognizer. You can call open/close to control the connection and call start/stop to control the recognition.

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 or ImageTracker.loadTargetBlocked 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 condition.

Constructor

C: void easyar_CloudRecognizer__ctor(easyar_CloudRecognizer * * Return)
C++11: CloudRecognizer()
Traditional C++: CloudRecognizer()
Java: public CloudRecognizer()
Objective-C: + (easyar_CloudRecognizer *) create
Swift (since EasyAR SDK 2.1.0): public convenience init()

open

Connect the server. It is a async call, you need to provide a callback to get the status.

C: void easyar_CloudRecognizer_open(easyar_CloudRecognizer * This, easyar_String * server, easyar_String * appKey, easyar_String * appSecret, easyar_FunctorOfVoidFromCloudStatus callback_open, easyar_FunctorOfVoidFromCloudStatusAndListOfPointerOfTarget callback_recognize)
C++11: void open(std::string server, std::string appKey, std::string appSecret, std::function<void(CloudStatus)> callback_open, std::function<void(CloudStatus, std::vector<std::shared_ptr<Target>>)> callback_recognize)
Traditional C++: void open(String * server, String * appKey, String * appSecret, FunctorOfVoidFromCloudStatus callback_open, FunctorOfVoidFromCloudStatusAndListOfPointerOfTarget callback_recognize)
Java: public native void open(java.lang.String server, java.lang.String appKey, java.lang.String appSecret, FunctorOfVoidFromCloudStatus callback_open, FunctorOfVoidFromCloudStatusAndListOfPointerOfTarget callback_recognize)
Objective-C: - (void)open:(NSString *)server appKey:(NSString *)appKey appSecret:(NSString *)appSecret callback_open:(void (^)(easyar_CloudStatus status))callback_open callback_recognize:(void (^)(easyar_CloudStatus status, NSArray<easyar_Target *> * targets))callback_recognize
Swift (since EasyAR SDK 2.1.0): public func `open`(_ server: String, _ appKey: String, _ appSecret: String, _ callback_open: @escaping (CloudStatus) -> Void, _ callback_recognize: @escaping (CloudStatus, [Target]) -> Void) -> Void

close

Closes the connection. You need to call open to reconnect the server.

C: bool easyar_CloudRecognizer_close(easyar_CloudRecognizer * This)
C++11: bool close()
Traditional C++: bool close()
Java: public native boolean close()
Objective-C: - (bool)close
Swift (since EasyAR SDK 2.1.0): public func close() -> Bool

attachStreamer

Attach FrameStreamer to the CloudRecognizer. CloudRecognizer will not start to recognize until a FrameStreamer is attached.

Attach null object will detach previous attached FrameStreamer from CloudRecognizer.

C: bool easyar_CloudRecognizer_attachStreamer(easyar_CloudRecognizer * This, easyar_FrameStreamer * obj)
C++11: bool attachStreamer(std::shared_ptr<FrameStreamer> obj)
Traditional C++: bool attachStreamer(FrameStreamer * obj)
Java: public native boolean attachStreamer(FrameStreamer obj)
Objective-C: - (bool)attachStreamer:(easyar_FrameStreamer *)obj
Swift (since EasyAR SDK 2.1.0): public override func attachStreamer(_ obj: FrameStreamer?) -> Bool

start

Starts the recognition.

C: bool easyar_CloudRecognizer_start(easyar_CloudRecognizer * This)
C++11: bool start()
Traditional C++: bool start()
Java: public native boolean start()
Objective-C: - (bool)start
Swift (since EasyAR SDK 2.1.0): public override func start() -> Bool

stop

Stops the recognition.

C: bool easyar_CloudRecognizer_stop(easyar_CloudRecognizer * This)
C++11: bool stop()
Traditional C++: bool stop()
Java: public native boolean stop()
Objective-C: - (bool)stop
Swift (since EasyAR SDK 2.1.0): public override func stop() -> Bool