cv2.error: OpenCV(4.1.1) C:\projects\opencv-python\opencv\modules\objdetect\src\cascadedetect.cpp:567: error: (-2:Unspecified error) in function 'bool __cdecl cv::HaarEvaluator::Feature::read(const class cv::FileNode &,const class cv::Size_<int> &)'
> Invalid HAAR feature (expected: 'rw.r.x < W'), where
> 'rw.r.x' is 17
> must be less than
> 'W' is 15
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:/PycharmProjects/Tsfresh/MouthDetector.py", line 9, in <module>
mouth_detector = cv2.CascadeClassifier(detection_mouth_path)
SystemError: <class 'cv2.CascadeClassifier'> returned a result with an error set
在*.xml文件中修改W的值,(注意不是在注释行),我将其修改为25。
<size> H W </size>
<opencv_storage>
<Boca_17stages type_id="opencv-haar-classifier">
<size>
25 25</size>
这篇博客讲述了在使用OpenCV进行面部检测时遇到的错误,涉及到Haar特征文件中的大小(W)设置不当。作者提到将W值从15改为25引发的问题,并提示读者修复方法是调整XML文件中<size>标签的数值。

2916

被折叠的 条评论
为什么被折叠?



