1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup cr_sdk 18 * @{ 19 * 20 * @brief Defines the development tool functions, constants, and error codes for card rectification (CR). 21 * 22 * @since 2.2 23 * @version 1.0 24 */ 25 26 /** 27 * @file cr_sdk.h 28 * 29 * @brief Defines the development tool functions for card rectification. 30 * 31 * @since 2.2 32 * @version 1.0 33 */ 34 35 #ifndef CR_SDK_H 36 #define CR_SDK_H 37 38 #include "cr_callback.h" 39 #include "cr_constants.h" 40 41 namespace OHOS { 42 namespace AI { 43 class CrSdk { 44 public: 45 CrSdk() = default; 46 47 ~CrSdk(); 48 49 /** 50 * @brief Establishes a connection from the development tool to the AI server. 51 * 52 * @return Returns {@link CR_RETCODE_SUCCESS} if the operation is successful; 53 * returns a non-zero error code defined by {@link PluginRetCode} otherwise. 54 * 55 * @since 2.2 56 * @version 1.0 57 */ 58 int32_t Prepare(); 59 60 /** 61 * @brief Imports images from the development tool to the card rectification model for prediction. 62 * 63 * @param [in] input Indicates the input image. 64 * @param [out] output Indicates the result. 65 * @return Returns {@link CR_RETCODE_SUCCESS} if the operation is successful; 66 * returns a non-zero error code defined by {@link PluginRetCode} otherwise. 67 * 68 * @since 2.2 69 * @version 1.0 70 */ 71 int32_t RectifyCardSync(const RectifyCardInput &input, RectifyCardOutput &output); 72 73 /** 74 * @brief Defines the asynchronous function. No impletementation for now. 75 * 76 * @param [in] input Indicates the input image. 77 * @param [in] callback Indicates the specified callback. 78 * @return Returns {@link CR_RETCODE_SUCCESS} if the operation is successful; 79 * returns a non-zero error code defined by {@link PluginRetCode} otherwise. 80 * 81 * @since 2.2 82 * @version 1.0 83 */ 84 int32_t RectifyCardAsync(const RectifyCardInput &input, const ICallback<RectifyCardOutput> &callback); 85 86 /** 87 * @brief Destroys the loaded model and related resources. 88 * 89 * @return Returns {@link CR_RETCODE_SUCCESS} if the operation is successful; 90 * returns a non-zero error code defined by {@link PluginRetCode} otherwise. 91 * 92 * @since 2.2 93 * @version 1.0 94 */ 95 int32_t Release(); 96 }; 97 } // namespace AI 98 } // namespace OHOS 99 100 #endif // CR_SDK_H 101 /** @} */ 102