Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information.
- import cv2
- face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
- img = cv2.imread('D:/14801853607540.jpg')
- gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
- faces = face_cascade.detectMultiScale(gray, 1.3, 5)
- Traceback (most recent call last):
- File "<pyshell#4>", line 1, in <module>
- faces = face_cascade.detectMultiScale(gray, 1.3, 5)
- cv2.error: D:\Build\OpenCV\opencv-3.3.0\modules\objdetect\src\cascadedetect.cpp:1698: error: (-215) !empty() in function cv::CascadeClassifier::detectMultiScale