In [1]:
import cv2 

averageCount = 30
cameraCapture = cv2.VideoCapture(0) 
cv2.namedWindow('MyWindow') 
print 'Averaging ' + str(averageCount) + ' frames.' 

success, frame = cameraCapture.read() 
w, h = frame.shape
iAverage = np.array(frame, np.float32)

while success and cv2.waitKey( 1) == -1:
    success, frame = cameraCapture.read()
    cv2. imshow('MyWindow', frame) 

cameraCapture.release()
cv2. destroyWindow('MyWindow')


Averaging 30 frames.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-174774e1938a> in <module>()
      7 
      8 success, frame = cameraCapture.read()
----> 9 w, h = frame.shape
     10 iAverage = np.array(frame, np.float32)
     11 

AttributeError: 'NoneType' object has no attribute 'shape'

In [ ]:


In [ ]: