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_constants.h 28 * 29 * @brief Defines the constants and, input and output formats for calling the card rectification plugin. 30 * 31 * @since 2.2 32 * @version 1.0 33 */ 34 35 #ifndef CR_CONSTANTS_H 36 #define CR_CONSTANTS_H 37 38 #include "kits/cv/ai_image.h" 39 40 #include <string> 41 #include <vector> 42 43 namespace OHOS { 44 namespace AI { 45 /** 46 * @brief Defines the algorithm version for the card rectification task. 47 * 48 * it must match related_sessions in services/common/protocol/plugin_config/plugin_config_ini/cv_card_rectification.ini 49 * 50 * @since 2.2 51 * @version 1.0 52 */ 53 const long long ALGORITHM_TYPE_VERSION_CR = 20001001; 54 55 typedef struct { 56 AiImage image; // original image 57 std::vector<std::vector<std::string>> templateTextZoom; // zero or more card text area templates 58 } RectifyCardInput; 59 60 typedef struct { 61 AiImage image; // output image of card area 62 FourVertex fourVertex; // coordinates of card in original image 63 int classIndex; // index of templateTextZoom, indicating card type 64 int pageIndex; // index of respondent cards 65 float confidence; // confidence 66 } RectifyCardOutput; 67 } // namespace AI 68 } // namespace OHOS 69 70 #endif // CR_CONSTANTS_H 71 /** @} */ 72