add dll version and its usage
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include "OCRToolBox.h"
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <onnxruntime_cxx_api.h>
|
||||
|
||||
namespace uns
|
||||
{
|
||||
class EasyOCR_Detector
|
||||
{
|
||||
private:
|
||||
const float lowText = 0.4f;
|
||||
const float textThreshold = 0.7f;
|
||||
const float linkThreshold = 0.4f;
|
||||
|
||||
private:
|
||||
const OrtApi* ort;
|
||||
|
||||
Ort::Env ort_env;
|
||||
Ort::Session* ort_cpu_session;
|
||||
Ort::SessionOptions ort_session_options;
|
||||
|
||||
bool ort_inited;
|
||||
std::wstring model_path;
|
||||
|
||||
IONames input_names, output_names;
|
||||
IONamesStorage input_ns, output_ns;
|
||||
|
||||
private:
|
||||
cv::Mat NormalizeMeanVariance(const cv::Mat& in);
|
||||
void AdjustResultCoordinates(EOCRD_Rects& polys, float ratioW, float ratioH, float ratioNet = 2.0f);
|
||||
void ResizeAspectRatio(const cv::Mat& src, cv::Mat& dst, float squareSize, float magRatio, float& ratio, cv::Size& heatmapSize);
|
||||
bool GetDetBoxesCore(const cv::Mat& textmap, const cv::Mat& linkmap, float textThresh, float linkThresh, float lowText, EOCRD_Rects& boxes, cv::Mat& labels, std::vector<int>& mapper, bool estimateNumChars);
|
||||
|
||||
public:
|
||||
EasyOCR_Detector();
|
||||
EasyOCR_Detector(const EasyOCR_Detector&) = delete;
|
||||
|
||||
public:
|
||||
bool Init();
|
||||
bool UnInit();
|
||||
bool RecheckModelInfo();
|
||||
/// <summary>
|
||||
/// EasyOCR 文本检测函数
|
||||
/// </summary>
|
||||
/// <param name="image">待检测的图像(三通道BGR图像)</param>
|
||||
/// <returns>检测到的矩形框</returns>
|
||||
EOCRD_Rects operator()(const cv::Mat& image);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user