繁体   English   中英

如何为 Pytesseract 处理此图像?

[英]How to process this image for Pytesseract?

我想自动解决这样的验证码。 我一直在尝试处理图像以使 Pytesseract 能够读取它,但没有成功。

你能帮助我吗?

图片

我试试这个:

import cv2
from pytesseract import image_to_string
import pytesseract




img = cv2.imread("screenshot.png")
img = cv2.resize(img, (0, 0), fx=16, fy=16)
gry = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
(h, w) = gry.shape[:2]
gry = cv2.resize(gry, (w*2, h*2))
cls = cv2.morphologyEx(gry, cv2.MORPH_CLOSE, None)
#thr = cv2.threshold(cls, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
thr = cv2.threshold(gry, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]
txt = image_to_string(,lang='eng', config='--psm 11')
cv2.imwrite('prv.png', thr)
print(txt)

AI/ML 解决验证码真的很难。 它们的核心是阻止 OCR。

考虑阅读这个: https : //www.cloudflare.com/learning/bots/how-captchas-work/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM