mac使用pytesseract

mac2022-06-30  25

import locale locale.setlocale(locale.LC_ALL, 'C') import pytesseract import pathlib import traceback from PIL import Image file_path = str(pathlib.Path.cwd().joinpath("picture/3.jpg")) img = Image.open(file_path) #先创建image对象 try: text = pytesseract.image_to_string(img,lang="eng") #直接转化成string,更多参数可以查看文档 print(text) except: print(traceback.format_exc())

转载于:https://www.cnblogs.com/c-x-a/p/10419189.html

最新回复(0)