diff --git a/tasks/visualization/vis_utils.py b/tasks/visualization/vis_utils.py index bf028f1..f56835d 100644 --- a/tasks/visualization/vis_utils.py +++ b/tasks/visualization/vis_utils.py @@ -230,7 +230,7 @@ def draw_bounding_box_on_image(image, # If the total height of the display strings added to the top of the bounding # box exceeds the top of the image, stack the strings below the bounding box # instead of above. - display_str_heights = [font.getsize(ds)[1] for ds in display_str_list] + display_str_heights = [font.font.getsize(ds)[1] for ds in display_str_list] # Each display_str has a top and bottom margin of 0.05x. total_display_str_height = (1 + 2 * 0.05) * sum(display_str_heights) @@ -240,7 +240,7 @@ def draw_bounding_box_on_image(image, text_bottom = bottom + total_display_str_height # Reverse list and print from bottom to top. for display_str in display_str_list[::-1]: - text_width, text_height = font.getsize(display_str) + text_width, text_height = font.font.getsize(display_str) margin = np.ceil(0.05 * text_height) draw.rectangle([(left, text_bottom - text_height - 2 * margin), (left + text_width, text_bottom)],