CloudRecognizer Class

Inherits: FrameFilter

Description

CloudRecognizer实现了云识别功能。

CloudRecognizer工作在自己的线程上。你需要首先调用attachStreamer将CloudRecognizer连接至 FrameStreamer ,然后 FrameStreamer 的输出图像将被CloudRecognizer使用。你可以调用open/close来控制连接以及start/stop来控制识别。

在使用CloudRecognizer之前,需要设置并准备好一个ImageTracker。任何返回的target在被track之前都应使用 ImageTracker.loadTargetImageTracker.loadTargetBlocked 手动加载进入ImageTracker。加载之后,target的识别和跟踪即和本地target的使用相同。在一个target被识别到之后,你可以从回调中获取到,然后你应该使用target uid来区分不同的target。target runtimeID是动态生成的,不适用于作为云识别情况下的target的唯一区分。

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

连接服务器。这是个异步调用,需要提供回调来获取状态。

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

关闭连接。重连服务器需要调用open。

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

FrameStreamer 连接到CloudRecognizer。在有 FrameStreamer 连接之前,CloudRecognizer不会开始运行识别。

Attach null object 将会断开CloudRecognizer之前与 FrameStreamer 的连接。

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

开始识别。

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

停止识别。

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