cv2.error: OpenCV(4.2.0) error: (-215:Assertion failed) !empty() in function 以上报错都是训练参数路径不对

当opencv-python安装好

当opencv-contrib-python安装好

运行python的opencv程序,报错如下

一、第一种

Traceback (most recent call last):
  File "face_detect.py", line 21, in
    cv.imshow("input image", src)
cv2.error: OpenCV(4.2.0) /io/opencv/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'

请检查你的代码,是不是有

detector = cv2.CascadeClassifier('/usr/local/lib/python3.6/dist-packages/cv2/data/haarcascade_frontalface_default.xml')

 

二、第二种


  File "with_mouth00.py", line 49, in
    faces = detector.detectMultiScale(gray,1.5, 5)
cv2.error: OpenCV(4.2.0) /io/opencv/modules/objdetect/src/cascadedetect.cpp:1689: error: (-215:Assertion failed) !empty() in function 'detectMultiScale'

请检查你的代码,是不是有

你可能感兴趣的:(python,**.py,运行opencv的程序出错,python,opencv,人脸识别,ubuntu)