提交 75d2c47d 编写于 作者: L LDOUBLEV

support multi-line text display

上级 8a6f1062
......@@ -117,7 +117,6 @@ if __name__ == "__main__":
valid_image_file_list.append(image_file)
img_list.append(img)
rec_res, predict_time = text_recognizer(img_list)
rec_res, predict_time = text_recognizer(img_list)
for ino in range(len(img_list)):
print("Predicts of %s:%s" % (valid_image_file_list[ino], rec_res[ino]))
print("Total predict time for %d images:%.3f" %
......
......@@ -176,6 +176,12 @@ def draw_ocr(image, boxes, txts, scores, draw_txt=True, drop_score=0.5):
"./doc/simfang.ttf", font_size, encoding="utf-8")
new_txt = str(count) + ': ' + txt + ' ' + '%.3f' % (
scores[count])
while len(new_txt) > 25:
tmp = new_txt
new_txt = tmp[:25]
draw_txt.text(
(20, gap * (count + 1)), new_txt, txt_color, font=font)
new_txt = tmp[25:]
draw_txt.text(
(20, gap * (count + 1)), new_txt, txt_color, font=font)
count += 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册