From 8d57008e2a3be81b38b27e2a7f7f2c3ab0e2bf04 Mon Sep 17 00:00:00 2001 From: sml2h3 Date: Mon, 29 Aug 2022 14:48:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86slide=5Fmatch?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=9C=A8simple=5Ftarget=E4=B8=BAFalse?= =?UTF-8?q?=E6=97=B6=E5=BC=82=E5=B8=B8=E6=83=85=E5=86=B5=EF=BC=8C=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=97=B6=E8=87=AA=E5=8A=A8=E8=AE=BE=E7=BD=AEsimple=5F?= =?UTF-8?q?target=E4=B8=BATrue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 20 +++++++++++++------- ddddocr/README.md | 26 ++++++++++++++++++-------- ddddocr/__init__.py | 13 ++++++++++--- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index e37e4fe..decdc0c 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,16 @@ # 带带弟弟OCR通用验证码识别SDK免费开源版 -# 2022/05/27 关注我的直播间 -[B站直播间-点击关注我哦~在线分享答疑](https://space.bilibili.com/313042688) -# 今天ddddocr又更新啦! - ## 当前版本为1.4.3 + +# 当前版本为1.4.7 + +## 1.4.3更新内容 本次升级的主要原因为,[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 的开源进行适配,使[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练出的模型可以直接无缝导入到ddddocr里面来使用 -## 使用ddddocr调用[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后的模型 +### 支持使用ddddocr调用 [dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后的自定义模型 [dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后会在models目录里导出charsets.json和onnx模型 @@ -31,8 +31,14 @@ print(res) # 捐赠 (如果项目有帮助到您,可以选择捐赠一些费用用于ddddocr的后续版本维护,本项目长期维护) - ![Test](https://cdn.wenanzhe.com/img/zhifubao.jpg!/scale/35) - ![Test](https://cdn.wenanzhe.com/img/weixin.jpg!/scale/35) + ![Test](https://cdn.wenanzhe.com/img/zhifubao.jpg!/scale/30) + ![Test](https://cdn.wenanzhe.com/img/weixin.jpg!/scale/30) + +# 赞助合作商 + +| 赞助合作商 | 推荐理由 | +|------------|--------------------------------------------------------------------------------------------------| +| [YesCaptcha](https://yescaptcha.com/i/NSwk7i) | 谷歌reCaptcha验证码 / hCaptcha验证码 / funCaptcha验证码商业级识别接口 [点我](https://yescaptcha.com/i/NSwk7i) 直达VIP4 | # 1.4.0版本更新内容 diff --git a/ddddocr/README.md b/ddddocr/README.md index 783f48b..decdc0c 100644 --- a/ddddocr/README.md +++ b/ddddocr/README.md @@ -2,12 +2,16 @@ # 带带弟弟OCR通用验证码识别SDK免费开源版 -# 今天ddddocr又更新啦! - ## 当前版本为1.4.3 + + + +# 当前版本为1.4.7 + +## 1.4.3更新内容 本次升级的主要原因为,[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 的开源进行适配,使[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练出的模型可以直接无缝导入到ddddocr里面来使用 -## 使用ddddocr调用[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后的模型 +### 支持使用ddddocr调用 [dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后的自定义模型 [dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后会在models目录里导出charsets.json和onnx模型 @@ -27,8 +31,14 @@ print(res) # 捐赠 (如果项目有帮助到您,可以选择捐赠一些费用用于ddddocr的后续版本维护,本项目长期维护) - ![Test](https://cdn.wenanzhe.com/img/zhifubao.jpg!/scale/35) - ![Test](https://cdn.wenanzhe.com/img/weixin.jpg!/scale/35) + ![Test](https://cdn.wenanzhe.com/img/zhifubao.jpg!/scale/30) + ![Test](https://cdn.wenanzhe.com/img/weixin.jpg!/scale/30) + +# 赞助合作商 + +| 赞助合作商 | 推荐理由 | +|------------|--------------------------------------------------------------------------------------------------| +| [YesCaptcha](https://yescaptcha.com/i/NSwk7i) | 谷歌reCaptcha验证码 / hCaptcha验证码 / funCaptcha验证码商业级识别接口 [点我](https://yescaptcha.com/i/NSwk7i) 直达VIP4 | # 1.4.0版本更新内容 @@ -225,8 +235,7 @@ cv2.imwrite("result.jpg", im) `Windows/Linux/Macos..` -M1X用户需要使用 ([传送门](https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-MacOSX-arm64.sh -))创建python环境后即可使用 +暂时不支持Macbook M1(X),M1(X)用户需要自己编译onnxruntime才可以使用 ## 安装命令 @@ -247,7 +256,8 @@ M1X用户需要使用 ([传送门](https://github.com/conda-forge/miniforge/re [crawlab](https://github.com/crawlab-team/crawlab) # 交流群 (加我好友拉你进群) - + + ![四群链接](https://cdn.wenanzhe.com/img/1d5ec7445d745a4d6790df352e1abb5.png!/scale/50) ![Test](https://cdn.wenanzhe.com/img/mmqrcode1640418911274.png!/scale/50) diff --git a/ddddocr/__init__.py b/ddddocr/__init__.py index 567b46b..d8ce49d 100644 --- a/ddddocr/__init__.py +++ b/ddddocr/__init__.py @@ -35,6 +35,7 @@ class DdddOcr(object): print("欢迎使用ddddocr,本项目专注带动行业内卷,个人博客:wenanzhe.com") print("训练数据支持来源于:http://146.56.204.113:19199/preview") print("爬虫框架feapder可快速一键接入,快速开启爬虫之旅:https://github.com/Boris-code/feapder") + print("谷歌reCaptcha验证码 / hCaptcha验证码 / funCaptcha验证码商业级识别接口:https://yescaptcha.com/i/NSwk7i") self.use_import_onnx = False self.__word = False self.__resize = [] @@ -1692,10 +1693,16 @@ class DdddOcr(object): end_x = x return image.crop([starttx, startty, end_x, end_y]), starttx, startty - def slide_match(self, target_bytes: bytes = None, background_bytes: bytes = None, simple_target: bool=False): + def slide_match(self, target_bytes: bytes = None, background_bytes: bytes = None, simple_target: bool=False, flag: bool=False): if not simple_target: - target, target_x, target_y = self.get_target(target_bytes) - target = cv2.cvtColor(np.asarray(target), cv2.IMREAD_ANYCOLOR) + try: + target, target_x, target_y = self.get_target(target_bytes) + target = cv2.cvtColor(np.asarray(target), cv2.IMREAD_ANYCOLOR) + except SystemError as e: + # SystemError: tile cannot extend outside image + if flag: + raise e + return self.slide_match(target_bytes=target_bytes, background_bytes=background_bytes, simple_target=True, flag=True) else: target = cv2.imdecode(np.frombuffer(target_bytes, np.uint8), cv2.IMREAD_ANYCOLOR) target_y = 0