|
@@ -19,8 +19,8 @@ def draw_box_with_label(frame, x_min, y_min, x_max, y_max, label):
|
|
line_height = text_height + size[1]
|
|
line_height = text_height + size[1]
|
|
# set the text start position
|
|
# set the text start position
|
|
text_offset_x = x_min
|
|
text_offset_x = x_min
|
|
- text_offset_y = 0 if y_min < line_height else y_min - line_height
|
|
|
|
|
|
+ text_offset_y = 0 if y_min < line_height else y_min - (line_height+8)
|
|
# make the coords of the box with a small padding of two pixels
|
|
# make the coords of the box with a small padding of two pixels
|
|
textbox_coords = ((text_offset_x, text_offset_y), (text_offset_x + text_width + 2, text_offset_y + line_height))
|
|
textbox_coords = ((text_offset_x, text_offset_y), (text_offset_x + text_width + 2, text_offset_y + line_height))
|
|
cv2.rectangle(frame, textbox_coords[0], textbox_coords[1], color, cv2.FILLED)
|
|
cv2.rectangle(frame, textbox_coords[0], textbox_coords[1], color, cv2.FILLED)
|
|
- cv2.putText(frame, label, (text_offset_x, text_offset_y + line_height - 2), font, fontScale=font_scale, color=(0, 0, 0), thickness=2)
|
|
|
|
|
|
+ cv2.putText(frame, label, (text_offset_x, text_offset_y + line_height - 3), font, fontScale=font_scale, color=(0, 0, 0), thickness=2)
|