Ask Your Question

Revision history [back]

face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')

these two is wrong. you should add the path .

 face_cascade =   
 cv2.CascadeClassifier(r'D:\OpenCV\opencv\sources\data\haarcascades\haarcascade_frontalface_default.xml')
 eye_cascade = cv2.CascadeClassifier(r'D:\OpenCV\opencv\sources\data\haarcascades\haarcascade_eye.xml')