50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#pragma once
|
|
#include <string>
|
|
#include "LibEasyOCR-CPP-Export.h"
|
|
|
|
namespace uns
|
|
{
|
|
namespace easyocr
|
|
{
|
|
enum class LIBEASYOCRCPP_API GPUUsage
|
|
{
|
|
ForceGPU, // 强制使用GPU(失败报错)
|
|
PreferGPU, // 优先GPU,失败回退
|
|
CPUOnly // 仅使用CPU
|
|
};
|
|
|
|
enum class LIBEASYOCRCPP_API CharsetType
|
|
{
|
|
EN, //英语
|
|
EN_CH //英语和中文
|
|
};
|
|
}
|
|
|
|
class LIBEASYOCRCPP_API OCRConfig
|
|
{
|
|
private:
|
|
easyocr::GPUUsage gpu_usage;
|
|
easyocr::CharsetType language;
|
|
|
|
public:
|
|
OCRConfig();
|
|
OCRConfig(const OCRConfig& obj) = delete;
|
|
OCRConfig(const std::wstring& detect_model, const std::wstring& reco_model, easyocr::CharsetType language, easyocr::GPUUsage gpu = easyocr::GPUUsage::PreferGPU);
|
|
|
|
public:
|
|
easyocr::GPUUsage GetGPUUsage() const;
|
|
easyocr::CharsetType GetLanguage() const;
|
|
|
|
std::wstring GetDetectModelPath() const;
|
|
std::wstring GetRecognizeModelPath() const;
|
|
|
|
public:
|
|
void SetGPUUsage(easyocr::GPUUsage usage);
|
|
void SetLanguage(easyocr::CharsetType type);
|
|
void SetDetectModelPath(const std::wstring& path);
|
|
void SetRecognizeModelPath(const std::wstring& path);
|
|
};
|
|
|
|
extern OCRConfig G_OCRConfig;
|
|
}
|