mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 13:34:23 +08:00
Fix PIL show()
and save()
(#8202)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
850ca8587f
commit
5e81651b4f
@ -332,11 +332,11 @@ class Annotator:
|
|||||||
|
|
||||||
def show(self, title=None):
|
def show(self, title=None):
|
||||||
"""Show the annotated image."""
|
"""Show the annotated image."""
|
||||||
(self.im if isinstance(self.im, Image.Image) else Image.fromarray(self.im[..., ::-1])).show(title)
|
Image.fromarray(np.asarray(self.im)[..., ::-1]).show(title)
|
||||||
|
|
||||||
def save(self, filename="image.jpg"):
|
def save(self, filename="image.jpg"):
|
||||||
"""Save the annotated image to 'filename'."""
|
"""Save the annotated image to 'filename'."""
|
||||||
(self.im if isinstance(self.im, Image.Image) else Image.fromarray(self.im[..., ::-1])).save(filename)
|
cv2.imwrite(filename, np.asarray(self.im))
|
||||||
|
|
||||||
def draw_region(self, reg_pts=None, color=(0, 255, 0), thickness=5):
|
def draw_region(self, reg_pts=None, color=(0, 255, 0), thickness=5):
|
||||||
"""
|
"""
|
||||||
@ -422,8 +422,6 @@ class Annotator:
|
|||||||
shape (tuple): imgsz for model inference
|
shape (tuple): imgsz for model inference
|
||||||
radius (int): Keypoint radius value
|
radius (int): Keypoint radius value
|
||||||
"""
|
"""
|
||||||
nkpts, ndim = keypoints.shape
|
|
||||||
nkpts == 17 and ndim == 3
|
|
||||||
for i, k in enumerate(keypoints):
|
for i, k in enumerate(keypoints):
|
||||||
if i in indices:
|
if i in indices:
|
||||||
x_coord, y_coord = k[0], k[1]
|
x_coord, y_coord = k[0], k[1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user