使用Opencv 4.1.0进行面部检测。调用detectMulitiScale函数时出现错误消息。
检查是否已安装OpenCV-contrib
import cv2
gray_img=cv2.imread("test_opencv.jpg",0)
face_cascade=cv2.CascadeClassifier("haarcascades_frontalface_default.xml")
faces=face_cascade.detectMulitiScale(gray_img,scaleFactor = 1.05,minNeighbors=5)
AttributeError跟踪(最近的调用) 最后) ----> 1 face = face_cascade.detectMulitiScale(gray_img,scaleFactor = 1.05,minNeighbors = 5)
AttributeError:“ cv2.CascadeClassifier”对象没有属性 'detectMulitiScale'