肾盂切除不良结果

2024-10-08 20:25:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在玩一个基于网络的游戏,试图破解一个反机器人。 我已经用Python/Selenium编写了一个bot,现在我正在尝试编写一个“破解反bot”函数

我已经拍摄了antibot的屏幕截图(因为antibot是一个php文件,在重新加载时会发生更改)

以下是反机器人的四张不同图片:

enter image description hereenter image description hereenter image description hereenter image description here

这是我的密码:

output = pytesseract.image_to_string(PIL.Image.open('ab1.png').convert("RGB"))
output2 = pytesseract.image_to_string(PIL.Image.open('ab2.png').convert("RGB"))
output3 = pytesseract.image_to_string(PIL.Image.open('ab3.png').convert("RGB"))
output4 = pytesseract.image_to_string(PIL.Image.open('ab4.png').convert("RGB"))
print (output, output2, output3, output4)

以及输出:

i A

使用Tesseract有没有办法获得更好的结果? 谢谢你的帮助


Tags: toimageconvertoutputstringpilpngbot
1条回答
网友
1楼 · 发布于 2024-10-08 20:25:55
def test1():
    # Grayscale, Gaussian blur, Otsu's threshold
    filename = ("teu.png")
    image = cv2.imread(filename, cv2.IMREAD_UNCHANGED)

    blur = cv2.GaussianBlur(gray, (1,1), 0)
    kernel = np.ones((1,1),np.float32)/25
    opening = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel, blur, iterations=1)

    # Perform text extraction
    data = pytesseract.image_to_string(opening, lang='eng', config=' psm 13')
    print(data)

    cv2.imshow('opening', opening)
    #cv2.imwrite(filename, opening)
    cv2.waitKey()

test1()

好的,我已经走了这么远。白底黑字。 但是,如何使文本更具可读性呢

输出如下所示:

enter image description here

相关问题 更多 >

    热门问题