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)
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 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

创建并连接服务器。

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

开始识别。

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()