- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 56.3k
Closed
Description
System information (version)
- OpenCV => 2.4.13.2
- Operating System / Platform => OS X El Capitan
- Language: Python
Detailed description
OpenCv library with python client works perfectly for the image processing. However, it throws up error when I try to use VideoCapture method.
Steps to reproduce
import numpy as np
import cv2
import sys
cap = cv2.VideoCapture("peopleCounter.avi")
w = cap.get(3) #get width
h = cap.get(4) #get height
mx = int(w/2)
my = int(h/2)
count = 0
ret, frame = cap.read()
while(cap.isOpened()):
   ret, frame = cap.read() #read a frame
   try:
       count = count + 1
       text = "Hello World " + str(count)
       cv2.putText(frame, text ,(mx,my),cv2.FONT_HERSHEY_SIMPLEX
                   ,1,(255,255,255),1,cv2.LINE_AA)
       cv2.imshow('Frame',frame)
   except:
       #if there are no more frames to show...
       print('EOF')
       break
   #Abort and exit with 'Q' or ESC
   k = cv2.waitKey(1000) & 0xff
   if k == 27:
       break
cap.release() #release video file
cv2.destroyAllWindows() #close all openCV windows