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

OpenCV  -- python 

>>> import cv2
>>> help(cv2)
...
IMREAD_ANYCOLOR = 4
IMREAD_ANYDEPTH = 2
IMREAD_COLOR = 1
IMREAD_GRAYSCALE = 0   #that will be it ;)
IMREAD_LOAD_GDAL = 8
IMREAD_UNCHANGED = -1
...
VERSION
    3.0.0-dev
-----------------------------------

CV_LOAD_IMAGE_GRAYSCALE is from the outdated [and now removed] cv api 

In OpenCV 3.1 for C++ you have to use cv::ImreadModes::IMREAD_GRAYSCALE which is located on 

cv2.CV_LOAD_IMAGE_GRAYSCALE  -->  cv2.IMAGE_GRAYSCALE

 

转载于:https://my.oschina.net/u/2272631/blog/1602248

你可能感兴趣的:(人工智能,python)