Optimize seg_bbox calculations (#19056)

This commit is contained in:
Muhammad Rizwan Munawar 2025-02-05 03:38:10 +05:00 committed by GitHub
parent 5bca9341e8
commit c5ac5548ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -801,9 +801,8 @@ class Annotator:
return
cv2.polylines(self.im, [np.int32([mask])], isClosed=True, color=mask_color, thickness=2)
text_size, _ = cv2.getTextSize(label, 0, self.sf, self.tf)
if label:
text_size, _ = cv2.getTextSize(label, 0, self.sf, self.tf)
cv2.rectangle(
self.im,
(int(mask[0][0]) - text_size[0] // 2 - 10, int(mask[0][1]) - text_size[1] - 10),