人脸识别报错cascadedetect.cpp:1698: error: (-215) !empty() in function detectMultiScale
来源:互联网 发布:网络创业培训试题 编辑:程序博客网 时间:2024/05/22 15:09
运行环境:
python2.7 64位
ubuntu16.04(amd64)
opencv 2.4.9
代码如下:
# face detectionimport numpyimport cv2face_cascade = cv2.CascadeClassifier("../../opencv-2.4.9/data/haarcascades/haarcascade_frontalface_default.xml")eye_cascade = cv2.CascadeClassifier('../../opencv-2.4.9/data/haarcascades/haarcascade_eye.xml')img = cv2.imread("hjt.jpg")gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)faces = face_cascade.detectMultiScale(gray, 1.3, 5)for (x,y,w,h) in faces: cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) roi_gray = gray[y:y+h, x:x+w] roi_color = img[y:y+h, x:x+w] eyes = eye_cascade.detectMultiScale(roi_gray) for (ex,ey,ew,eh) in eyes: cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)cv2.imshow('img',img)cv2.waitKey(0)cv2.destroyAllWindows()
报错的时候,把上面代码中的以下两行的路径检查一下就行了。
face_cascade = cv2.CascadeClassifier("../../opencv-2.4.9/data/haarcascades/haarcascade_frontalface_default.xml")eye_cascade = cv2.CascadeClassifier('../../opencv-2.4.9/data/haarcascades/haarcascade_eye.xml')
最终运行结果:
阅读全文
0 0
- 人脸识别报错cascadedetect.cpp:1698: error: (-215) !empty() in function detectMultiScale
- Python OpenCV 解决人脸识别报错cascade.detectMultiScale error
- grabcut.cpp:380: error: (-215) !bgdSamples.empty() && !fgdSamples.empty() in function initGMMs
- opencv人脸识别--detectMultiScale函数
- ceph-deploy osd activate报错ERROR: error creating empty object store in xxx Permission den
- opencv报错 error: (-215) size.width>0 && size.height>0 in function cv::imshow
- PHP连接Mysql报错 Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /Application
- opencv使用detectMultiScale报错原因
- cygwin编译报错:**.cpp:1:1: error: stray '\377' in program解决方法
- bonnie++安装报错zcav.cpp:73: error: ‘strdup’ was not declared in this scope
- <c:if test="${empty(*)}"> 报错javax.el.ELException: Function ':empty' not found;
- PHP扩展开发报错解决[error: ‘PHP_FE_END’ undeclared here (not in a function)] .
- g++报错原因分析error: no......member function declared in class 'XXX‘
- 关于Fatal error: Can't use function return value in write context报错的解决方法!
- Error:Cause: zip file is empty-----FirstBundle导入报错
- Error Function in PeopleSoft
- 处理【Fatal error: Can't use function return value in write context 】的情况之《empty的解析》
- 处理【Fatal error: Can't use function return value in write context 】的情况之《empty的解析》
- 懒汉式单列
- if(this is life)then{enjoyAllOfIt}
- List源码解析之LinkedList 源码分析
- LintCode-(3)统计数字
- 三、ValueAnimator属性动画的基本使用
- 人脸识别报错cascadedetect.cpp:1698: error: (-215) !empty() in function detectMultiScale
- golang基础-beego_web开发、模板使用(待续)
- Makefile编写小例
- mysql编译安装过程内存不足
- 教程篇(5.4) NSE4 22. 硬件加速 ❀ 飞塔 (Fortinet) 网络安全专家
- C++适配器的使用总结
- 技术分享
- leetCode-K-diff Pairs in an Array
- mysql事务还原点操作