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.

28 lines
902 B
C++

#pragma once
#include <map>
#include <functional>
#include <filesystem>
#include <opencv2/core/core.hpp>
#include <onnxruntime_cxx_api.h>
namespace uns
{
using VecInt = std::vector<int>;
using VecFloat = std::vector<float>;
using IONames = std::vector<const char*>;
using IONamesStorage = std::vector<std::string>;
using EOCR_Result = std::pair<std::wstring, float>;
using EOCR_ResultSet = std::map<size_t, EOCR_Result>;
using EOCRD_Rects = std::vector<std::vector<cv::Point2f>>;
class OCRToolBox
{
public:
static bool CheckFile(const std::wstring& file);
static void InitOrtSessionOptions(Ort::SessionOptions& se_opt);
static bool AutoSelectEP(const OrtApi* ort, Ort::SessionOptions& se_opt, bool& fallback_to_cpu);
static void GetInputOutputNames(Ort::Session* ort_session, IONames& input_names, IONamesStorage& input_ns, IONames& output_names, IONamesStorage& output_ns);
};
}