# Our operations on the frame come here
import cv2
head_cascade = cv2.CascadeClassifier('head_cascade.xml')
camera = cv2.VideoCapture(0, cv2.CAP_DSHOW)
while(True):
# Capture frame-by-frame
ret, frame = camera.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
heads = head_cascade.detectMultiScale(gray, 1.3, 3)
for (x,y,w,h) in heads:
camera = cv2.rectangle(camera,(x,y),(x+w,y+h),(0,255,0),2)
roi_gray = gray[y:y+h, x:x+w]
roi_color = img[y:y+h, x:x+w]
# Display the resulting frame
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
camera.release()
cv2.destroyAllWindows()
break
Traceback (most recent call last):
camera = cv2.rectangle(camera,(x,y),(x+w,y+h),(0,255,0),2)
TypeError: an integer is required (got type tuple)