Initial setup for CLion

This commit is contained in:
2026-03-28 16:54:11 +11:00
parent 239cc02591
commit 7b4134133c
1136 changed files with 811916 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
#pragma once
#include "ONNXOCRTypes.h"
#include "ONNXOCRDetector.h"
#include "ONNXOCRClassifier.h"
#include "ONNXOCRRecognizer.h"
#include <memory>
#include <mutex>
#include <string>
#include <vector>
namespace ANSCENTER {
namespace onnxocr {
// PaddleOCR V5 pipeline engine: Detection -> (Classification) -> Recognition
// Mirrors the PaddleOCR::PPOCR interface for drop-in replacement
class PaddleOCRV5Engine {
public:
PaddleOCRV5Engine() = default;
~PaddleOCRV5Engine() = default;
// Initialize the OCR pipeline
// clsModelPath can be empty to skip classification
bool Initialize(const std::string& detModelPath,
const std::string& clsModelPath,
const std::string& recModelPath,
const std::string& dictPath);
// Run full OCR pipeline on an image
// Returns results matching PaddleOCR::OCRPredictResult format
std::vector<OCRPredictResult> ocr(const cv::Mat& img);
// Configuration setters (matching OCRModelConfig parameters)
void SetDetMaxSideLen(int val) { _maxSideLen = val; }
void SetDetDbThresh(float val) { _detDbThresh = val; }
void SetDetBoxThresh(float val) { _detBoxThresh = val; }
void SetDetUnclipRatio(float val) { _detUnclipRatio = val; }
void SetClsThresh(float val) { _clsThresh = val; }
void SetUseDilation(bool val) { _useDilation = val; }
private:
std::unique_ptr<ONNXOCRDetector> detector_;
std::unique_ptr<ONNXOCRClassifier> classifier_; // nullptr if not used
std::unique_ptr<ONNXOCRRecognizer> recognizer_;
std::recursive_mutex _mutex;
// Detection parameters
int _maxSideLen = kDetMaxSideLen;
float _detDbThresh = kDetDbThresh;
float _detBoxThresh = kDetBoxThresh;
float _detUnclipRatio = kDetUnclipRatio;
bool _useDilation = false;
// Classifier parameters
float _clsThresh = kClsThresh;
bool _initialized = false;
};
} // namespace onnxocr
} // namespace ANSCENTER