From ec1e74ce418fe1ba3511c92e4a3bef2f3c2b8e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Fri, 15 Nov 2024 03:44:19 +0800 Subject: [PATCH] fix --- cpp/LunaOCR/OCR.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cpp/LunaOCR/OCR.cpp b/cpp/LunaOCR/OCR.cpp index 47044a6a..d7726865 100644 --- a/cpp/LunaOCR/OCR.cpp +++ b/cpp/LunaOCR/OCR.cpp @@ -1,3 +1,4 @@ +#ifndef WINXP #include #include #include @@ -632,13 +633,13 @@ std::vector OcrLite::getPartImages(cv::Mat &src, std::vector & return partImages; } -void matRotateClockWise180(cv::Mat& src) +void matRotateClockWise180(cv::Mat &src) { flip(src, src, 0); flip(src, src, 1); } -void matRotateClockWise90(cv::Mat& src) +void matRotateClockWise90(cv::Mat &src) { transpose(src, src); flip(src, src, 1); @@ -704,13 +705,14 @@ std::vector OcrLite::detect_internal(cv::Mat &src, cv::Rect &originRe return textBlocks; } - +#endif struct ocrpoints { int x1, y1, x2, y2, x3, y3, x4, y4; }; DECLARE_API OcrLite *OcrInit(const wchar_t *szDetModel, const wchar_t *szRecModel, const wchar_t *szKeyPath, int nThreads) { +#ifndef WINXP OcrLite *pOcrObj = nullptr; try { @@ -727,10 +729,14 @@ DECLARE_API OcrLite *OcrInit(const wchar_t *szDetModel, const wchar_t *szRecMode { return nullptr; } +#else + return nullptr; +#endif } DECLARE_API void OcrDetect(OcrLite *pOcrObj, const void *binptr, size_t size, Directional mode, void (*cb)(ocrpoints, const char *)) { +#ifndef WINXP if (!pOcrObj) return; @@ -750,10 +756,13 @@ DECLARE_API void OcrDetect(OcrLite *pOcrObj, const void *binptr, size_t size, Di catch (...) { } +#endif } DECLARE_API void OcrDestroy(OcrLite *pOcrObj) { +#ifndef WINXP if (pOcrObj) delete pOcrObj; +#endif } \ No newline at end of file