diff --git a/App_Code/OcrHelper.cs.exclude b/App_Code/OcrHelper.cs.exclude deleted file mode 100644 index af6bada..0000000 --- a/App_Code/OcrHelper.cs.exclude +++ /dev/null @@ -1,65 +0,0 @@ -using PaddleOCRSharp; -using System; -using System.Drawing; - -public class OcrHelper -{ - - //private static TesseractEngine engine = new TesseractEngine("./ocr_models", "chi_sim"); - //public static OCRResult GetOcrResult(Bitmap bitmap) - //{ - // try - // { - // using var tempBitmap = new Bitmap(bitmap); - // var ocrResult = paddleOCREngine.DetectText(tempBitmap); - // return ocrResult; - // } - // catch (Exception ex) - // { - // ExceptionNotice.SendAsync(ex, "Ocr文字识别异常!"); - // throw; - // } - //} - - private static string RootDirectory = EngineBase.GetRootDirectory().TrimEnd('\\') + "\\inference"; - - //建议程序全局初始化一次即可,不必每次识别都初始化,容易报错。 - private static PaddleOCREngine paddleOCREngine = paddleOCREngine = new PaddleOCREngine(new OCRModelConfig() - { - det_infer = RootDirectory + "\\ch_PP-OCRv3_det_infer", - cls_infer= RootDirectory + "\\ch_ppocr_mobile_v2.0_cls_infer", - rec_infer = RootDirectory + "\\ch_PP-OCRv3_rec_infer", - keys = RootDirectory + "\\ppocr_keys.txt", - }, new OCRParameter()); - - public static OCRResult GetOcrResult(Bitmap bitmap) - { - try - { - using (var tempBitmap = new Bitmap(bitmap)) - { - return paddleOCREngine.DetectText(tempBitmap); - } - } - catch (Exception ex) - { - throw; - } - } - - public static OCRResult GetOcrResult(byte[] bytes) - { - try - { - var ocrResult = paddleOCREngine.DetectText(bytes); - return ocrResult; - } - catch (Exception ex) - { - - throw; - } - } - -} - diff --git a/packages.config b/packages.config index 006af33..c9c1bdd 100644 --- a/packages.config +++ b/packages.config @@ -1,5 +1,4 @@  - \ No newline at end of file