Skip to content

EasyOCR

Ready-to-use OCR with 40+ languages supported including Chinese, Japanese, Korean and Thai.

Example

import easyocr
reader = easyocr.Reader(['en', 'ja'])
result = reader.readtext('2.jpg')
print(result)

좀 더 긴 버전

import cv2
import easyocr
import matplotlib.pyplot as plt

# 이미지 읽기
image_path = 'aaa.png'
image = cv2.imread(image_path)

# ROI 설정 (x, y, w, h: 좌표와 크기)
x, y, w, h = 0,1035,1070,(1080-1035)
roi = image[y:y+h, x:x+w]

# EasyOCR 객체 생성
reader = easyocr.Reader(['en'], gpu=False)

# ROI에서 문자 인식
result = reader.readtext(roi)
print(result)

# 결과 출력
for (bbox, text, prob) in result:
    print(f"Detected text: {text} (Confidence: {prob:.2f})")

# 원본 이미지와 ROI를 함께 출력
plt.figure(figsize=(10, 5))
plt.subplot(1, 2, 1)
plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
plt.title('Original Image')

plt.subplot(1, 2, 2)
plt.imshow(cv2.cvtColor(roi, cv2.COLOR_BGR2RGB))
plt.title('ROI')

plt.show()

See also

Favorite site