MCPcopy Create free account
hub / github.com/devilsen/CZXing / start_label

Method start_label

python/Labeler.py:53–83  ·  view source on GitHub ↗
(self, dir_path, images)

Source from the content-addressed store, hash-verified

51 print("识别完成 Total = " + str(self.total) + " 成功识别 = " + str(self.success) + " 失败 = " + str(self.fail))
52
53 def start_label(self, dir_path, images):
54 self.abs_dir_path = os.path.abspath(dir_path)
55 self.total += len(images)
56 for image_file in images:
57 # print("start label image = " + image_file)
58 if not is_image(image_file):
59 continue
60
61 image_path = os.path.join(dir_path, image_file)
62 image_name = image_file.split(".")[0]
63 image_suffix = image_file.split(".")[1]
64 print("image path = " + image_path)
65
66 image_size = get_image_size(image_path)
67 print("image size = " + str(image_size))
68
69 qr_code_results = self.decode_qr_code(image_path)
70 if qr_code_results is None or len(qr_code_results) <= 0:
71 print("no qr code")
72 self.collect_special_image(image_path)
73 self.fail += 1
74 continue
75
76 # 转化为 Yolo 位置
77 label_data_list = self.translate_data(image_size, qr_code_results)
78
79 # 保存同名文件
80 label_string = self.get_result_data(label_data_list)
81 self.save_file(image_suffix, image_path, label_string)
82
83 print("----------------------- one image done ---------------------------\n")
84
85 def init_index(self):
86 result_dir = self.abs_result_dir_path

Callers 1

read_dirMethod · 0.95

Calls 8

decode_qr_codeMethod · 0.95
collect_special_imageMethod · 0.95
translate_dataMethod · 0.95
get_result_dataMethod · 0.95
save_fileMethod · 0.95
is_imageFunction · 0.85
get_image_sizeFunction · 0.85
printFunction · 0.50

Tested by

no test coverage detected