Tag Archives: AttributeError: module ‘cv2’ has no attribute ‘CV_HAAR_SCALE_IMAGE’

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

Explain the function of static keyword and final keyword in Java in detail>>>

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 <opencv2/imgcodecs.hpp>

cv2.CV_LOAD_IMAGE_GRAYSCALE –> cv2.IMAGE_GRAYSCALE