错误:函数detectMultiScale中的(-215)!empty()
我正在尝试在python 2.7中学习cv2,但是当我运行代码时,在它的特定部分: face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml') img = cv2.imread('2015-05-27-191152.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) faces = face_cascade.detectMultiScale(gray, 1.3, 5) for (x,y,w,h) in faces: img = cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) 它返回此: File "face_detection.py", line 11, in <module> faces = face_cascade.detectMultiScale(gray, 1.3, 5) cv2.error: /home/arthurckl/Desktop/opencv-3.0.0-rc1/modules/objdetect/src/cascadedetect.cpp:1595: error: (-215) !empty() in function detectMultiScale 我试图在此处搜索答案,但我能找到的最好的办法是,我必须以错误的方式加载face_cascade ...有帮助吗?