title: How to read a single frame with opencv
body: <p>Whenever I try to capture just one frame from a video (I want to basically take a picture with my webcam) I just get a black window. I am having the same problems as SajjadAbbas in the comments in:</p>
  
  <p><a href="https://stackoverflow.com/questions/47824785/capturing-a-single-frame-with-python-using-a-webcam">Capturing a single frame with Python (using a webcam)</a></p>
  
  <p>My code is very simple and I suspect there may be a problem with the drivers but have no idea how to remedy that. He says he was able to get it to work by using a different program, but I cannot comment to find out what exactly he means by that.</p>
  
  <pre><code>`import cv2
  
  cap = cv2.VideoCapture(0)
  
  ret, frame = cap.read()
  print(ret)
  rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)
  
  while(True):
      cv2.imshow('frame', rgb)
      if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          out = cv2.imwrite('capture.jpg', frame)
          break
  
  cap.release()
  cv2.destroyAllWindows()`
  </code></pre>