Skip to content

Commit 29e1650

Browse files
authored
[Fix]: set new height and width on Mac OS (#8434)
1 parent 56e42e7 commit 29e1650

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mmdet/core/visualization/image.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Copyright (c) OpenMMLab. All rights reserved.
2+
import sys
3+
24
import cv2
35
import matplotlib.pyplot as plt
46
import mmcv
@@ -350,6 +352,8 @@ def imshow_det_bboxes(img,
350352

351353
stream, _ = canvas.print_to_buffer()
352354
buffer = np.frombuffer(stream, dtype='uint8')
355+
if sys.platform == 'darwin':
356+
width, height = canvas.get_width_height(physical=True)
353357
img_rgba = buffer.reshape(height, width, 4)
354358
rgb, alpha = np.split(img_rgba, [3], axis=2)
355359
img = rgb.astype('uint8')

0 commit comments

Comments
 (0)