title: Screen Capture with OpenCV and Python-2.7
body: <p>I'm using <em>Python 2.7</em> and <em>OpenCV 2.4.9</em>.</p>
  
  <p>I need to capture the current frame that is being shown to the user and load it as an <em>cv::<b>Mat</em></b> object in Python.</p>
  
  <p>Do you guys know a fast way to do it recursively?</p>
  
  <p>I need something like what's done in the example below, that captures <em><b>Mat</b></em> frames from a webcam recursively:</p>
  
  <pre><code>import cv2
  
  cap = cv2.VideoCapture(0)
  while(cap.isOpened()):
      ret, frame = cap.read()
      cv2.imshow('WindowName', frame)
      if cv2.waitKey(25) &amp; 0xFF == ord('q'):
          cap.release()
          cv2.destroyAllWindows()
          break
  </code></pre>
  
  <p>In the example it's used the <em>VideoCapture class</em> to work with the captured image from the webcam.</p>
  
  <p>With VideoCapture.read() a new frame is always being readed and stored into a <b><em>Mat</em></b> object.</p>
  
  <p>Could I load a <em>"printscreens stream"</em> into a VideoCapture object? Could I create a streaming of my computer's screen with OpenCV in Python, without having to save and delete lots of <em>.bmp</em> files per second?</p>
  
  <p>I need this frames to be <b><em>Mat</em></b> objects or <b><em>NumPy arrays</em></b>, so I can perform some Computer Vision routines with this frames in real time.</p>