pytesseract識別效果

import pytesseract
from PIL import  Image
import os


# 測試默認的中文識別
chi_result = pytesseract.image_to_string(Image.open('/Users/hqh/Desktop/3.jpeg'),lang='chi_sim')
print(chi_result) # 輸出 水

# 測試數字英文識別
en_result = pytesseract.image_to_string(Image.open('/Users/hqh/Desktop/p1.jpeg'))
print(en_result)  # 輸出 1364


# 測試python生成的驗證碼

captcha_result=pytesseract.image_to_string(Image.open('/Users/hqh/Desktop/okeQ.png'))
print(captcha_result) # 結果爲空,識別不了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章