1

I use a Python Module EasyOCR for extracting text from image. This Method works for PNG Format but in TIFF Situation give me a error

Code look like this:

import easyocr 
import cv2
from matplotlib import pyplot as plt
import numpy as np 

IMAGE_PATH = 'IMG_4022.tif'

reader = easyocr.Reader(['en'], gpu=False)
result = reader.readtext(IMAGE_PATH)
result

I work with Juypter Notebook

  • Please provide the details of the error. – fam Jan 31 '22 at 11:42
  • @fam error: OpenCV(4.5.4) /Users/runner/work/opencv-python/opencv-python/opencv/modules/imgproc/src/resize.cpp:4051: error: (-215:Assertion failed) !ssize.empty() in function 'resize' – Feyza Keles Jan 31 '22 at 11:53

1 Answers1

2

You are not reading the image. Please use opencv to read the image. Ensure that the image is in the current directory or provide the absolute path of the image.

from easyocr import Reader 
import cv2
from matplotlib import pyplot as plt
import numpy as np 

IMAGE_PATH = "IMG_4022.tif"
image = cv2.imread(IMAGE_PATH)

languages = ['en']

reader = Reader(languages, gpu = False)
results = reader.readtext(image)
fam
  • 583
  • 3
  • 14