title: The cv2.imshow not showing webcam video and not opening any window
body: <p>I have an issue with showing up the window and cam capture using OpenCV</p>
  <p>When i'm run the script, i see that the cam is working, but the window with this cam is not showing anywhere, i've had just the Python icon showed up but it`s even not clickable.</p>
  <p><img src="https://i.stack.imgur.com/fKyTY.png" alt="here" /></p>
  <p>setup:</p>
  <ul>
  <li>macOS Big Sur 11.4</li>
  <li>python 3.8</li>
  <li>cv2 4.2.0</li>
  </ul>
  <p>I`ve tried to:</p>
  <ul>
  <li>Add sleep before <code>ret, frame = video_capture.read()</code></li>
  <li>Change cv2.waitKey() to 0, 1, and 500</li>
  <li>Had tested on my notebook cam, and on phone using IriunWebcam</li>
  <li>Tried different IDEs(Visual code, and PyCharm), and tried to run the
  script in the terminal</li>
  </ul>
  <pre><code>import cv2
  import sys
  import logging as log
  import datetime as dt
  from time import sleep
  
  faceCascade = cv2.CascadeClassifier('/Users/***/Documents/GitHub/FaceAuth/haarcascade_frontalface_default.xml')
  log.basicConfig(filename='webcam.log', level=log.INFO)
  
  video_capture = cv2.VideoCapture(0)  # 0 for phone cam, 1 for pc cam
  anterior = 0
  
  while True:
      if not video_capture.isOpened():
          print('Unable to load camera.')
          sleep(5)
          pass
  
      # Capture frame-by-frame
      ret, frame = video_capture.read()
  
      gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
  
      faces = faceCascade.detectMultiScale(gray, 1.1, 4)
  
      # Draw a rectangle around the faces
      for (x, y, w, h) in faces:
          cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)
  
      if anterior != len(faces):
          anterior = len(faces)
          log.info(&quot;faces: &quot; + str(len(faces)) + &quot; at &quot; + str(dt.datetime.now()))
  
      # Display the resulting frame
      cv2.imshow('Video', frame)
  
      if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          break
  
      # Display the resulting frame
      cv2.imshow('Video', frame)
  
  # When everything is done, release the capture
  video_capture.release()
  cv2.destroyAllWindows()
  
  </code></pre>
  <p><img src="https://i.stack.imgur.com/RqrH3.png" alt="here" /> This is my variables in debug breakpoint, before <code>cv2.imshow('Video', frame)</code></p>