Skip to content

Commit

Permalink
Avoid cv2 window init code on Windows (#8712)
Browse files Browse the repository at this point in the history
Resolves #8642
  • Loading branch information
glenn-jocher committed Jul 25, 2022
1 parent 0ab303b commit 7215a0f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import argparse
import os
import platform
import sys
from pathlib import Path

Expand Down Expand Up @@ -173,7 +174,7 @@ def run(
# Stream results
im0 = annotator.result()
if view_img:
if p not in windows:
if platform.system() == 'Linux' and p not in windows:
windows.append(p)
cv2.namedWindow(str(p), cv2.WINDOW_NORMAL | cv2.WINDOW_KEEPRATIO) # allow window resize (Linux)
cv2.resizeWindow(str(p), im0.shape[1], im0.shape[0])
Expand Down

0 comments on commit 7215a0f

Please sign in to comment.