Avoid cv2 window init code on Windows (#8712)
Resolves https://github.com/ultralytics/yolov5/issues/8642
This commit is contained in:
1 parent
0ab303b044
commit
7215a0fb41
1 file changed
+2
-1
@@ -26,6 +26,7 @@ Usage - formats:
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -173,7 +174,7 @@ def run(
|
|||||||
# Stream results
|
# Stream results
|
||||||
im0 = annotator.result()
|
im0 = annotator.result()
|
||||||
if view_img:
|
if view_img:
|
||||||
if p not in windows:
|
if platform.system() == 'Linux' and p not in windows:
|
||||||
windows.append(p)
|
windows.append(p)
|
||||||
cv2.namedWindow(str(p), cv2.WINDOW_NORMAL | cv2.WINDOW_KEEPRATIO) # allow window resize (Linux)
|
cv2.namedWindow(str(p), cv2.WINDOW_NORMAL | cv2.WINDOW_KEEPRATIO) # allow window resize (Linux)
|
||||||
cv2.resizeWindow(str(p), im0.shape[1], im0.shape[0])
|
cv2.resizeWindow(str(p), im0.shape[1], im0.shape[0])
|
||||||
|
|||||||
Reference in new issue
Block a user