|
|
@@ -185,7 +185,7 @@ def plot_one_box(x, im, color=None, label=None, line_thickness=3): |
|
|
|
|
|
|
|
def plot_one_box_PIL(box, im, color=None, label=None, line_thickness=None): |
|
|
|
# Plots one bounding box on image 'im' using PIL |
|
|
|
print('##line149:',box) |
|
|
|
|
|
|
|
im = Image.fromarray(im) |
|
|
|
draw = ImageDraw.Draw(im) |
|
|
|
line_thickness = line_thickness or max(int(min(im.size) / 200), 2) |
|
|
@@ -193,7 +193,7 @@ def plot_one_box_PIL(box, im, color=None, label=None, line_thickness=None): |
|
|
|
|
|
|
|
if label: |
|
|
|
fontsize = max(round(max(im.size) / 40), 12) |
|
|
|
font = ImageFont.truetype("platech.ttf", fontsize,encoding='utf-8') |
|
|
|
font = ImageFont.truetype("../AIlib2/conf/platech.ttf", fontsize,encoding='utf-8') |
|
|
|
txt_width, txt_height = font.getsize(label) |
|
|
|
draw.rectangle([box[0], box[1] - txt_height + 4, box[0] + txt_width, box[1]], fill=tuple(color)) |
|
|
|
draw.text((box[0], box[1] - txt_height + 1), label, fill=(255, 255, 255), font=font) |