簡體   English   中英

pyTesseract不從圖像輸出文本

[英]pyTesseract not outputing text from image

也許有人可以幫助我! 當我運行以下代碼時

從 pytesseract 導入 pytesseract 從 PIL 導入 image_to_string 導入圖像導入 PIL

file = Image.open('/usr/local/Cellar/tesseract/4.1.0/share/tessdata/cap.png')
we_will = pytesseract.image_to_string(file)
print(we_will)

輸出的所有內容是:

Process finished with exit code 0

這是沒有幫助的。 我究竟做錯了什么?

聽起來像we_will是空字符串。 嘗試打印repr(we_will)以更清楚地理解這個想法。

IIRC,PyTesseract 在無法弄清楚圖像中的文本時會執行此操作。 對於具有單色背景的裁剪圖像,您可以獲得最佳效果。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM