Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
- faces = CascadeClassifier.detectMultiScale(gray, scaleFactor=1.5, minNeighbors=5)
- for (x, y, w, h) in faces:
- print(x,y,w,h)
- roi_gray = gray[y:y+h, x:x+w]
- roi_color = gray[y:y+h, x:x+w]
- img_item = 'image.png'
- cv2.imwrite(img_item, roi_gray)
- # Our operations on the frame come here
- color = (255,0,0) #BGR 0=255
- stroke = 2
- end_cord_x = x + w
- end_cord_y = y + h
- cv2.rectangle(frame, (x, y), (end_cord_x, end_cord_y), color, stroke)
- # Display the resulting frame
- cv2.imshow('frame',frame)
- if cv2.waitKey(20) & 0xFF == ord('q'):
- break
- # When everything done, release the capture
- cap.release()
- cv2.destroyAllWindows()
- File "camera-test.py", line 34, in <module>
- end_cord_x = x + w
- NameError: name 'x' is not defined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement