MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / get_image_file_list

Function get_image_file_list

tools/utils/utility.py:34–49  ·  view source on GitHub ↗
(img_file)

Source from the content-addressed store, hash-verified

32
33
34def get_image_file_list(img_file):
35 imgs_lists = []
36 if img_file is None or not os.path.exists(img_file):
37 raise Exception("not found any img file in {}".format(img_file))
38
39 if os.path.isfile(img_file) and _check_image_file(img_file):
40 imgs_lists.append(img_file)
41 elif os.path.isdir(img_file):
42 for single_file in os.listdir(img_file):
43 file_path = os.path.join(img_file, single_file)
44 if os.path.isfile(file_path) and _check_image_file(file_path):
45 imgs_lists.append(file_path)
46 if len(imgs_lists) == 0:
47 raise Exception("not found any img file in {}".format(img_file))
48 imgs_lists = sorted(imgs_lists)
49 return imgs_lists
50
51
52def binarize_img(img):

Callers 10

mainFunction · 0.90
__call__Method · 0.90
mainFunction · 0.90
mainFunction · 0.90
infer_doc.pyFile · 0.90
mainFunction · 0.90
__call__Method · 0.90
__call__Method · 0.90
mainFunction · 0.90
mainFunction · 0.90

Calls 1

_check_image_fileFunction · 0.85

Tested by

no test coverage detected