CloudRecognizer Class¶
Description¶
CloudRecognizer实现了云识别功能。云识别功能需要在云端创建云识别图库才能使用,请参考EasyAR CRS文档。
CloudRecognizer占用1个camera的buffer。应使用camera的setBufferCapacity设置不少于所有组件占用的camera的buffer数量。参考 概览 _ 。
创建之后,可以调用start/stop来开始和停止运行。
当不再需要该组件时,可以调用close对其进行关闭。close之后不应继续使用。
CloudRecognizer通过inputFrameSink输入 InputFrame ,应将 InputFrameSource 连接到inputFrameSink上进行使用。参考 概览 _ 。
在使用CloudRecognizer之前,需要设置并准备好一个 ImageTracker 。任何返回的target在被track之前都应使用 ImageTracker.loadTarget 手动加载进入 ImageTracker 。加载之后,target的识别和跟踪即和本地target的使用相同。在一个target被识别到之后,你可以从回调中获取到,然后你应该使用target uid来区分不同的target。target runtimeID是动态生成的,不适用于作为云识别情况下的target的唯一区分。
isAvailable¶
返回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 输入端口。要求必须拥有图像和时间戳。
- C: void easyar_CloudRecognizer_inputFrameSink(easyar_CloudRecognizer * This, easyar_InputFrameSink * * Return)¶
- 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¶
(since 3.1.0)
当前组件占用camera buffer的数量。
- 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¶
(until 3.0.1)
创建并连接服务器。
- C: void easyar_CloudRecognizer_create(easyar_String * server, easyar_String * appKey, easyar_String * appSecret, easyar_CallbackScheduler * callbackScheduler, easyar_OptionalOfFunctorOfVoidFromCloudStatusAndListOfTarget callback, easyar_CloudRecognizer * * Return)¶
- Traditional C++: static void create(String * server, String * appKey, String * appSecret, CallbackScheduler * callbackScheduler, OptionalOfFunctorOfVoidFromCloudStatusAndListOfTarget callback, CloudRecognizer * * Return)¶
- Java: public static @Nonnull CloudRecognizer create(java.lang.@Nonnull String server, java.lang.@Nonnull String appKey, java.lang.@Nonnull String appSecret, @Nonnull CallbackScheduler callbackScheduler, @Nullable FunctorOfVoidFromCloudStatusAndListOfTarget callback)¶
- Kotlin: companion object fun create(server: String, appKey: String, appSecret: String, callbackScheduler: CallbackScheduler, callback: FunctorOfVoidFromCloudStatusAndListOfTarget?): CloudRecognizer¶
- Objective-C: + (easyar_CloudRecognizer *)create:(NSString *)server appKey:(NSString *)appKey appSecret:(NSString *)appSecret callbackScheduler:(easyar_CallbackScheduler *)callbackScheduler callback:(void (^)(easyar_CloudStatus status, NSArray<easyar_Target *> * targets))callback¶
- Swift: public static func create(_ server: String, _ appKey: String, _ appSecret: String, _ callbackScheduler: CallbackScheduler, _ callback: ((CloudStatus, [Target]) -> Void)?) -> CloudRecognizer¶
- C#: public static CloudRecognizer create(string server, string appKey, string appSecret, CallbackScheduler callbackScheduler, Optional<Action<CloudStatus, List<Target>>> callback)¶
create¶
(since 3.1.0)
创建并连接服务器。
- 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)¶
- 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¶
开始识别。
- 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¶
暂停识别。
- 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¶
停止识别并关闭连接。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()¶