Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion easyocr/easyocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def readtext(self, image, decoder = 'greedy', beamWidth= 5, batch_size = 1,\
Parameters:
image: file path or numpy-array or a byte stream object
'''
img, img_cv_grey = reformat_input(image)
img, img_cv_grey = reformat_input(image, verbose=self.verbose)

horizontal_list, free_list = self.detect(img,
min_size = min_size, text_threshold = text_threshold,\
Expand Down
8 changes: 6 additions & 2 deletions easyocr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,10 +729,14 @@ def progress_hook(count, blockSize, totalSize):

return progress_hook

def reformat_input(image):
def reformat_input(image, verbose=True):
if type(image) == str:
if image.startswith('http://') or image.startswith('https://'):
tmp, _ = urlretrieve(image , reporthook=printProgressBar(prefix = 'Progress:', suffix = 'Complete', length = 50))
reportHook = printProgressBar(prefix = 'Progress:', suffix = 'Complete', length = 50)
if not verbose:
reportHook = None

tmp, _ = urlretrieve(image , reporthook=reportHook)
img_cv_grey = cv2.imread(tmp, cv2.IMREAD_GRAYSCALE)
os.remove(tmp)
else:
Expand Down