You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.2 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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;
std::wstring detect_model_path;
std::wstring recognize_model_path;
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;
}