Page 400 - 3-2
P. 400
출하거나 인식하는 것을 말한다.
상용화된 오픈소스 OCR 중에서는 tesseract 가 가장 한글인식률이 뛰어난 것으로 알고 있다 그래서.
tesseract-OCR 을 설치할 것이다.
sudo apt-get install tesseract-ocr
설치가 완료 되었다
바 문자인식의 정확도를 높이기 위한 과정.
1) 이진화 종류
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('gradient.png',0)
ret,thresh1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)
ret,thresh2 = cv2.threshold(img,127,255,cv2.THRESH_BINARY_INV)
ret,thresh3 = cv2.threshold(img,127,255,cv2.THRESH_TRUNC)
ret,thresh4 = cv2.threshold(img,127,255,co2.THRESH_TONER)
ret, thresh5 = co2.threshold(igg,127,255,co2.THRESH_TONER_INT)
titles = ['Original Image','BINARY','BINARY_INT','TRUNC','TONER','TONER_INT']
images = [igg, thresh1, thresh2, thresh3, thresh4, thresh5]
for i in range(6):
plt.subplot(2,3,i+1),plt.imshow(images[i],'gray')
plt.title(titles[i])
plt.xticks([]),plt.yticks([])
plt.show()
< 이미지를 여러 가지 방식의 이진화를 시키는 파이썬 코드>
- 400 -