-1

我想自动解决像这样的验证码。我一直在尝试处理图像以使 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)
4

1 回答 1

0

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

考虑阅读以下内容: https ://www.cloudflare.com/learning/bots/how-captchas-work/

于 2021-10-28T18:16:26.270 回答