/*
* Copyright 2024 KylinSoft Co., Ltd.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
#ifndef __KYLIN_AI_CORE_AI_VISION_TEXT_RECOGNITION_H__
#define __KYLIN_AI_CORE_AI_VISION_TEXT_RECOGNITION_H__
#include
#include "config.h"
#include "textrecognitionresult.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _TextRecognitionSession TextRecognitionSession;
typedef void (*TextRecognitionResultCallback)(TextRecognitionResult *result,
void *user_data);
// 创建session
AISDK_EXTERN
TextRecognitionSession *text_recognition_create_session();
// 销毁session
AISDK_EXTERN
void text_recognition_destroy_session(TextRecognitionSession **session);
// 初始化session
AISDK_EXTERN
int text_recognition_init_session(TextRecognitionSession *session);
// 设置结果回调
AISDK_EXTERN
void text_recognition_result_set_callback(
TextRecognitionSession *session, TextRecognitionResultCallback callback,
void *user_data);
// 配置Ocr模型
AISDK_EXTERN
void text_recognition_set_model_config(TextRecognitionSession *session,
TextRecognitionModelConfig *config);
// 从图像文件中识别
AISDK_EXTERN
void text_recognition_recognize_text_from_image_file_async(
TextRecognitionSession *session, const char *image_file);
// 从图像数据中进行识别
AISDK_EXTERN
void text_recognition_recognize_text_from_image_data_async(
TextRecognitionSession *session, const char *image_data,
unsigned int image_data_length);
#ifdef __cplusplus
}
#endif
#endif