解决AttributeError: module ‘cv2’ has no attribute ‘CV_HAAR_SCALE_IMAGE’


问题描述:

代码:

frontalFaces = faceCascade.detectMultiScale(image, scaleFactor=1.3, minNeighbors=5, minSize=(30, 30), flags = cv2.cv.CV_HAAR_SCALE_IMAGE)

报错如下:

AttributeError: module 'cv2' has no attribute 'cv'

(此处将’cv’改为’cv2’ 报错:AttributeError: module ‘cv2’ has no attribute ‘cv2’)

改为

frontalFaces = faceCascade.detectMultiScale(image, scaleFactor=1.3, minNeighbors=5, minSize=(30, 30), flags = cv2.CV_HAAR_SCALE_IMAGE)

报错如下:

AttributeError: module 'cv2' has no attribute 'CV_HAAR_SCALE_IMAGE'

原因分析:

子模块cv已从opencv 3.0中移除。


解决方案:

cv2.cv.CV_HAAR_SCALE_IMAGE改为cv2.CASCADE_SCALE_IMAGE
亲测有效!!!


另看到一篇博文遇到类似的OpenCV的版本问题,指路→

AttributeError: module ‘cv2.cv2’ has no attribute ‘cv’

解决AttributeError: module ‘cv2‘ has no attribute ‘CV_HAAR_SCALE_IMAGE‘相关推荐

  1. 解决: AttributeError: module 'cv2' has no attribute 'SURF'

    AttributeError: module 'cv2' has no attribute 'SURF' 遇到该问题时,网友多是建议补个包,即pip install opencv-contrib-py ...

  2. 成功解决AttributeError: module 'cv2.cv2' has no attribute 'CV_CAP_PROP_FPS'和 'CV_CAP_PROP_FRAME_WIDTH'

    成功解决AttributeError: module 'cv2.cv2' has no attribute 'CV_CAP_PROP_FPS'和 'CV_CAP_PROP_FRAME_WIDTH' 目 ...

  3. 成功解决AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d'

    成功解决AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d' 目录 解决问题 解决思路 解决方法 解决问题 Attribute ...

  4. Python3 AttributeError: module 'cv2' has no attribute 'SIFT'

    参考 https://blog.csdn.net/yuxuan_08/article/details/87966840 在用python3使用sift = cv2.SIFT()进行SIFT时候,可能会 ...

  5. AttributeError: module ‘cv2‘ has no attribute ‘SIFT‘

    问题:在用python3使用sift = cv2.SIFT()进行SIFT时候,可能会产生错误:AttributeError: module 'cv2' has no attribute 'SIFT' ...

  6. python3 opencv AttributeError: module 'cv2' has no attribute '__version__'

    报错:AttributeError: module 'cv2' has no attribute '__version__' AttributeError: module 'cv2' has no a ...

  7. 成功解决AttributeError: module ‘tensorflow‘ has no attribute ‘placeholder‘

    成功解决AttributeError: module 'tensorflow' has no attribute 'placeholder' 目录 解决问题 解决思路 解决方法 T1.降低tensor ...

  8. 成功解决AttributeError: module ‘tensorflow‘ has no attribute ‘contrib‘

    成功解决AttributeError: module 'tensorflow' has no attribute 'contrib' 目录 解决问题 解决思路 解决方法 解决方法

  9. 成功解决AttributeError: module ‘tensorflow‘ has no attribute ‘get_variable‘

    成功解决AttributeError: module 'tensorflow' has no attribute 'get_variable' 目录 解决问题 解决思路 解决方法 解决问题 Attri ...

最新文章

  1. 看懂SQL Server的查询计划(绝对好文!)
  2. 在线抓图WebSnap Beta 1.2 更新
  3. RollingFileAppender
  4. 使用阿里云ACM简化你的Spring Cloud微服务环境配置管理
  5. 455. Assign Cookies - LeetCode
  6. 解决maltab的中文和英文字体问题,中文乱码
  7. STM8S105系列单片机管脚复用配置(选项字节的配置)
  8. pmp知识点详解-项目大牛整理_PMP核心知识点—第四章:项目整合管理(一)
  9. Linux入门学习(五)
  10. Windows下安装和配置Maven的方法及注意事项
  11. kafka in action
  12. 家里蹲太孤单?用 Python 画一只单身狗 | 原力计划
  13. 什么是可加,半可加,不可加事实?
  14. C++ 完全不完全资源导引
  15. 一个将Google Maps API与ArcGIS JavaScript API for GMaps结合的例子
  16. x星球出入站(蓝桥杯递归)
  17. 使用Vulkan画三角形
  18. 深入理解计算机系统-cachelab
  19. python 绘制正弦余弦函数 matplotlib的基本使用
  20. 我会安静的忘记你:伤感爱情空间日志

热门文章

  1. 【Parallax Animation】实现知乎 Android 客户端启动页视差滚动效果
  2. R 数据分析学习笔记
  3. 【SpringBoot学习笔记】二、配置文件
  4. 计算机网络 实验九 路由器的基本配置(解答)
  5. Windows延缓写入失败
  6. 薅羊毛 | 让Python每天帮你薅一个早餐钱
  7. linux6.3 插u盘,[转载]使用CentOS 6.3制作linux U盘启动盘
  8. QMT vs Ptrade 速度对比 (二)实时行情速度对比
  9. Miniconda安装pytorch
  10. 电商平台-销售管理设计与架构