解决OpenCV问题:OpenCV Error: Assertion failed (!empty()) in cv::CascadeClassifier::detectMultiScale,
目录
解决问题
解决思路
解决方法
解决问题
OpenCV Error: Assertion failed (!empty()) in cv::CascadeClassifier::detectMultiScale, file C:projectsopencv-pythonopencvmodulesobjdetectsrccascadedetect.cpp, line 1698
Traceback (most recent call last):
File "F:File_PythonPython_daydayup180324.py", line 22, in <module>
flags=cv2.CASCADE_SCALE_IMAGE
cv2.error: C:projectsopencv-pythonopencvmodulesobjdetectsrccascadedetect.cpp:1698: error: (-215) !empty() in function cv::CascadeClassifier::detectMultiScale
解决思路
OpenCV级联检测器Cascadedetect出现错误,可知是xml路径读取错误,不要直接写入相对路径,要改为xml文件所在的绝对路径即可!
解决方法
![a78b8386e52666d892d914c7782de973.png](https://i-blog.csdnimg.cn/blog_migrate/2f97c34a0abddba02095af3d7d150626.png)
![4d94343423bf846f3a116675d3709624.png](https://i-blog.csdnimg.cn/blog_migrate/5f344fb9a9645c8b9770025638ad72ad.png)
![e60414b0fdac9915b4e5f9bfca07e4cc.png](https://i-blog.csdnimg.cn/blog_migrate/f823563f1be466b0a805111748cba093.jpeg)
![4d94343423bf846f3a116675d3709624.png](https://i-blog.csdnimg.cn/blog_migrate/5f344fb9a9645c8b9770025638ad72ad.png)
进行检测一下,哈哈大功告成!