輸入pytesseract PILのインポートイメージから イム= Image.open( 'image.png') (pytesseract.image_to_string(IM))を印刷
インストール:
環境変数は2に設定する必要があります
。1、パス
2、TESSDATA_PREFIX
初期パスを
= pytesseract.pytesseract.tesseract_cmd 'D://Tesseract-OCR//tesseract.exe'
tessdata_dir_config = 'DIR --- tessdata "D:// tessdata OCR-たTesseract"'
イメージ切断認識
IM = Image.open(old_file) R、C = im.size newR = C // 7 であれば!右= 0 : ボックス = (左、低、右、高) 他: ボックス = (左、低、R、ハイ) 領域 = im.crop(ボックス) S = pytesseract.image_to_string(領域、LANG = ' chi_sim ')