Skip to content

Commit

Permalink
adjust txt word in line
Browse files Browse the repository at this point in the history
  • Loading branch information
LDOUBLEV committed May 25, 2020
1 parent afecc49 commit eec9155
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tools/infer/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,14 @@ 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:
while len(new_txt) > 28:
tmp = new_txt
new_txt = tmp[:25]
new_txt = tmp[:28]
draw_txt.text(
(20, gap * (count + 1)), new_txt, txt_color, font=font)
new_txt = tmp[25:]
new_txt = tmp[28:]
count += 1

draw_txt.text(
(20, gap * (count + 1)), new_txt, txt_color, font=font)
count += 1
Expand Down

0 comments on commit eec9155

Please sign in to comment.