Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What am I doing wrong?

image description

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
click to hide/show revision 2
None

updated 2017-11-13 11:35:11 -0600

berak gravatar image

What am I doing wrong?

image description

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
    cv2 face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
    cv2.CascadeClassifier('haarcascade_frontalface_default.xml') img = cv2.imread('D:/14801853607540.jpg')
    cv2.imread('D:/14801853607540.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    cv2.COLOR_BGR2GRAY) faces = face_cascade.detectMultiScale(gray, 1.3, 5)
5)
    Traceback (most recent call last):

    last): File "<pyshell#4>", line 1, in <module>
    <module> faces = face_cascade.detectMultiScale(gray, 1.3, 5)

    5) cv2.error: D:\Build\OpenCV\opencv-3.3.0\modules\objdetect\src\cascadedetect.cpp:1698: error: (-215) !empty() in function cv::CascadeClassifier::detectMultiScale
cv::CascadeClassifier::detectMultiScale