Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

your image is empty. probably the VideoCapture did not open correctly.

please check:

cam = cv2.VideoCapture(0)
if not cam.isOpened(): raise Exception("could not open camera")

and later:

    ret, im =cam.read()
    if not ret: break # no image

then, please avoid using deprecated cv2.cv things, they're entirely gone in recent opencv, use cv2.putText() and cv2.FONT_HERSHEY_SIMPLEX instead.