#pragma once #include #include #include #include "OCRConfig.h" #include #include "LibEasyOCR-CPP-Export.h" namespace uns { namespace easyocr { using EOCR_Result = std::tuple; using EOCR_Result_Single = std::tuple; using EOCR_ResultSet = std::map; using EOCRD_Rects = std::vector>; } class LIBEASYOCRCPP_API EasyOCR_CPP { public: static OCRConfig& GlobalOCRConfig(); static void SetRecognitionModel(const std::wstring& reco_model, easyocr::CharsetType language); static bool CleanupOCR(); static bool InitDetectionModel(); static bool InitRecognitionModel(); static easyocr::EOCRD_Rects Detect(const cv::Mat& img); static easyocr::EOCR_Result Recognize(const cv::Mat& img); static easyocr::EOCR_ResultSet Recognize(const cv::Mat& img, const easyocr::EOCRD_Rects& rects); static easyocr::EOCR_ResultSet FullAuto(const cv::Mat& img); }; class LIBEASYOCRCPP_API EOCR_SupportTools { public: static std::string WtoA(const std::wstring& wstr); static std::wstring AtoW(const std::string& str); static std::string AtoUTF8(const std::string& str); static std::string UTF8toA(const std::string& utf8); static cv::Mat ReadImage(const std::string& file, bool blur = false, int blur_size = 3); static cv::Mat ReadImage(const std::wstring& file, bool blur = false, int blur_size = 3); }; }