title: "cv::VideoCapture::open VIDEOIO(CV_IMAGES): raised OpenCV exception"
body: <p>When i use the VsCode debugger to run the code i dont get any error at all and everything works fine, but when i try to run the code without the debugger i get this error:</p>
  
  <pre><code>[ERROR:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap.cpp (116) cv::VideoCapture::open VIDEOIO(CV_IMAGES): raised OpenCV exception:
  
  OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): vtest.avi in function 'cv::icvExtractPattern' 
  </code></pre>
  
  <p>I use OpenCV 4.2.0.32 and numpy 1.18.1</p>
  
  <p>The code i use is:</p>
  
  <pre class="lang-py prettyprint-override"><code>import cv2
  import numpy as np
  
  video = cv2.VideoCapture("vtest.avi")
  
  ret, frame1 = video.read()
  ret, frame2 = video.read()
  
  
  while video.isOpened():
      try:
          difference = cv2.absdiff(frame1, frame2)
          grayscale = cv2.cvtColor(difference, cv2.COLOR_BGR2GRAY)
          blur = cv2.GaussianBlur(grayscale, (5, 5), 0)
          _, threshold = cv2.threshold(blur, 35, 255, cv2.THRESH_BINARY)
          dilated = cv2.dilate(threshold, None, iterations=2)
          contours, _ = cv2.findContours(dilated, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
  
          for contour in contours:
              (x, y, w, h) = cv2.boundingRect(contour)
              if cv2.contourArea(contour) &lt; 950:
                  continue
              cv2.drawContours(frame1, contours, -1, (0, 255, 0), 1)
              cv2.rectangle(frame1, (x, y), (x+w, y+h), (120, 0, 150), 2)
  
          cv2.imshow("feed", frame1)
          frame1 = frame2
          ret, frame2 = video.read()
  
          if cv2.waitKey(50) == 27:
              break
      except:
          break
  
  cv2.destroyAllWindows()
  video.release()
  </code></pre>