Face detection using Cascade Classifier in opencv python

前端 未结 8 1244
[愿得一人]
[愿得一人] 2020-12-31 21:36

I am using the inbuilt cascade classifier for the face detection. This is how the code is (OpenCV Python Tutorials):

import numpy as np
import cv2

face_casc         


        
8条回答
  •  悲&欢浪女
    2020-12-31 22:10

    Refer to this line of code, it failed on checking that cascade is non empty. Please check path to XML files with trained cascades. You may need to specify full path to XML's like this:

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

    Or just put this files to directory containig your script.

提交回复
热议问题