mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 21:44:22 +08:00
Revert PIL deprecation fix (#305)
This commit is contained in:
parent
43b7dd0513
commit
12c87ac00c
@ -60,7 +60,8 @@ class Annotator:
|
|||||||
if self.pil or not is_ascii(label):
|
if self.pil or not is_ascii(label):
|
||||||
self.draw.rectangle(box, width=self.lw, outline=color) # box
|
self.draw.rectangle(box, width=self.lw, outline=color) # box
|
||||||
if label:
|
if label:
|
||||||
_, _, w, h = self.font.getbbox(label) # text width, height
|
w, h = self.font.getsize(label) # text width, height (WARNING: deprecated) in 9.2.0
|
||||||
|
# _, _, w, h = self.font.getbbox(label) # text width, height (New)
|
||||||
outside = box[1] - h >= 0 # label fits outside box
|
outside = box[1] - h >= 0 # label fits outside box
|
||||||
self.draw.rectangle(
|
self.draw.rectangle(
|
||||||
(box[0], box[1] - h if outside else box[1], box[0] + w + 1,
|
(box[0], box[1] - h if outside else box[1], box[0] + w + 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user