lang/py
library Tesseract - OCR test
C/H
2019. 1. 25. 18:03
- 2019/01/23 - [Language/Python] - library Pillow - thumbnail create
- 2019/01/24 - [Language/Python] - library Tesseract - OCR
이미지 처리 후 OCR 결과 얻기
from PIL import Image import subprocess def cleanFile(filePath, newFilePath): image = Image.open(filePath) # 회색 임계점 설정후 저장 image = image.point(lambda x: 0 if x<143 else 255) image.save(newFilePath) # 테세렉트 읽기 subprocess.call(["tesseract", newFilePath, "output"]) # 텍스트 결과값 확인 out = open("output.txt", "r") print(out.read()) out.close() cleanFile("test.tiff", "text_clean.tiff")
파이썬으로 웹 크롤러 만들기 한빛 미디어11.2 형식이 일정한 텍스트 처리, 207p
반응형