33 lines
1.3 KiB
C
33 lines
1.3 KiB
C
|
|
#ifndef ANSPaddleOCR_H
|
||
|
|
#define ANSPaddleOCR_H
|
||
|
|
#pragma once
|
||
|
|
#include "opencv2/core.hpp"
|
||
|
|
#include "opencv2/imgcodecs.hpp"
|
||
|
|
#include "opencv2/imgproc.hpp"
|
||
|
|
#include <iostream>
|
||
|
|
#include <vector>
|
||
|
|
#include "LabVIEWHeader/extcode.h"
|
||
|
|
#include "ANSLicense.h"
|
||
|
|
#include "ANSOCRBase.h"
|
||
|
|
#include <include/paddleocr.h>
|
||
|
|
|
||
|
|
namespace ANSCENTER {
|
||
|
|
|
||
|
|
class ANSOCR_API ANSCPUOCR :public ANSOCRBase {
|
||
|
|
public:
|
||
|
|
[[nodiscard]] virtual bool Initialize(const std::string& licenseKey, OCRModelConfig modelConfig, const std::string& modelZipFilePath, const std::string& modelZipPassword, int engineMode) override;
|
||
|
|
[[nodiscard]] std::vector<ANSCENTER::OCRObject> RunInference(const cv::Mat& input);
|
||
|
|
[[nodiscard]] std::vector<ANSCENTER::OCRObject> RunInference(const cv::Mat& input, const std::string &cameraId);
|
||
|
|
[[nodiscard]] std::vector<ANSCENTER::OCRObject> RunInference(const cv::Mat& input, const std::vector<cv::Rect>& Bbox);
|
||
|
|
[[nodiscard]] std::vector<ANSCENTER::OCRObject> RunInference(const cv::Mat& input, const std::vector<cv::Rect> &Bbox, const std::string& cameraId);
|
||
|
|
~ANSCPUOCR();
|
||
|
|
[[nodiscard]] bool Destroy();
|
||
|
|
private:
|
||
|
|
std::unique_ptr<PaddleOCR::PPOCR> ppocr = std::make_unique<PaddleOCR::PPOCR>();
|
||
|
|
std::mutex _mutex;
|
||
|
|
cv::Mat _frameBuffer; // Reusable buffer for color conversion
|
||
|
|
|
||
|
|
};
|
||
|
|
}
|
||
|
|
#endif
|