38 lines
1.4 KiB
C++
38 lines
1.4 KiB
C++
#ifndef ANSOnnxOCR_H
|
|
#define ANSOnnxOCR_H
|
|
#pragma once
|
|
#include "opencv2/core.hpp"
|
|
#include "opencv2/imgcodecs.hpp"
|
|
#include "opencv2/imgproc.hpp"
|
|
#include <iostream>
|
|
#include <vector>
|
|
#include <mutex>
|
|
#include "ANSOCRBase.h"
|
|
#include "ANSONNXOCR/PaddleOCRV5Engine.h"
|
|
|
|
namespace ANSCENTER {
|
|
|
|
class ANSOCR_API ANSONNXOCR : public ANSOCRBase {
|
|
public:
|
|
virtual bool Initialize(const std::string& licenseKey, OCRModelConfig modelConfig,
|
|
const std::string& modelZipFilePath, const std::string& modelZipPassword,
|
|
int engineMode) override;
|
|
|
|
std::vector<ANSCENTER::OCRObject> RunInference(const cv::Mat& input) override;
|
|
std::vector<ANSCENTER::OCRObject> RunInference(const cv::Mat& input, const std::string& cameraId) override;
|
|
std::vector<ANSCENTER::OCRObject> RunInference(const cv::Mat& input, const std::vector<cv::Rect>& Bbox) override;
|
|
std::vector<ANSCENTER::OCRObject> RunInference(const cv::Mat& input, const std::vector<cv::Rect>& Bbox, const std::string& cameraId) override;
|
|
|
|
std::pair<std::string, float> RecognizeText(const cv::Mat& croppedImage) override;
|
|
std::vector<std::pair<std::string, float>> RecognizeTextBatch(
|
|
const std::vector<cv::Mat>& croppedImages) override;
|
|
~ANSONNXOCR();
|
|
bool Destroy() override;
|
|
|
|
private:
|
|
std::unique_ptr<onnxocr::PaddleOCRV5Engine> _engine = std::make_unique<onnxocr::PaddleOCRV5Engine>();
|
|
std::recursive_mutex _mutex;
|
|
};
|
|
}
|
|
#endif
|