class 'cv2.CascadeClassifier' returned a result with an error set

查了2天,发现原来是不能使用网上下载的“haarcascade_frontalface_default.xml”

使用自己系统中原有的“haarcascade_frontalface_default.xml”

因为是anconda下配置的环境,cv2的xml文件路径为“C:\ProgramData\Anaconda3\envs\tensorflow\Lib\site-packages\cv2\data”

使用网上下载的发在和.py文件一个路径下,出现错误“class 'cv2.CascadeClassifier' returned a result with an error set”

修改为C:\ProgramData\Anaconda3\envs\tensorflow\Lib\site-packages\cv2\data\haarcascade_frontalface_default.xml

可以正常显示。

 

参考了别人的回答,自己本地建一个xml,然后在线打开github中的haarcascade_frontalface_default.xml,拷贝过来,也可以运行!

cv2

opencv-contrib-python (4.1.0.25)
opencv-python (3.4.1.15)

是在虚拟环境tensorflow 下安装的,

                                            activate tensorflow

                                            pip install -i -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python

                                            pip install -i -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-contrib-python

 

我的系统是win7 64    anconda3.0 创建了虚拟环境 tensorflow,在安装tensorflow时时

tensorboard (1.13.1)
tensorflow (1.13.1)
tensorflow-estimator (1.13.0)
tensorflow-tensorboard (1.5.1)

查看tensorboard图形。

切换到 tensorflow虚拟环境   activate tensorflow

                                            pip install -i -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow1.13

                                             pip install -i -i https://pypi.tuna.tsinghua.edu.cn/simple tensorboard1.13

  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值