Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

there needs to be a cv2.waitKey() call after cv2.imshow() (that's where the actual drawing happens), like:

        cv2.imshow('Frame',img) 
        k = cv2.waitKey(10) # yield 10 ms back to your OS
        if k==27: break # escape

there needs to be a cv2.waitKey() call after cv2.imshow() once per frame

(that's where the actual drawing happens), also you only need 1 imshow() call per loop, like:

for(x,y,w,h) in faces:
 ...
 cv2.putText(img, str(id), (x+5,y-5), font, 1, (255,255,255), 2)

cv2.imshow('Frame',img) 
 k = cv2.waitKey(10) # yield 10 ms back to your OS
 if k==27: break # escape

there needs to be a cv2.waitKey() call after cv2.imshow() once per frame

(that's where the actual drawing happens),

also you only need 1 imshow() call per loop, loop (and it has to show an image regardless if it finds any faces, too), like:

for(x,y,w,h) in faces:
    ...
    cv2.putText(img, str(id), (x+5,y-5), font, 1, (255,255,255), 2)

cv2.imshow('Frame',img) 
k = cv2.waitKey(10) # yield 10 ms back to your OS
if k==27: break # escape