목록Deep Learning/Computer Vision (23)
Note

import cv2 as cv import numpy as np import matplotlib.pyplot as plt import PIL %matplotlib inline from sklearn.cluster import KMeans clt = KMeans(n_clusters=5) clt.fit(img.reshape(-1,3)) def show_img_compar(img_1, img_2 ): f, ax = plt.subplots(1, 2, figsize=(10,10)) ax[0].imshow(img_1) ax[1].imshow(img_2) ax[0].axis('off') #hide the axis ax[1].axis('off') f.tight_layout() img = cv.imread("test1...

!pip install easyocr from PIL import Image import matplotlib.pyplot as plt import cv2 reader = easyocr.Reader(['ko', 'en'], gpu=True) # 한글과 영어 학습 result = reader.readtext("test.jpg") print(result) 이전 pytesseract 보다는 전처리를 하지 않아도 한글에 대한 성능이 조금 더 괜찮은 것을 볼 수 있다.

from PIL import Image from pytesseract import * import re import cv2 config = ('-l kor --oem 3 --psm 4') im = cv2.imread('test.jpg') print(pytesseract.image_to_string(im,config = config)) # gray scale img_gray = cv2.imread('test.jpg',cv2.IMREAD_GRAYSCALE) print('추출 한글 : ',pytesseract.image_to_string(im,config = config)) print('그레이 변환 후 추출 한글 : ' ,pytesseract.image_to_string(img_gray,config = con..