Search code examples
opencvopencv3.1

'module' object has no attribute 'CreateStructuringElementEx'


es = cv.CreateStructuringElementEx(9,9, 4,4, cv.CV_SHAPE_ELLIPSE)

AttributeError: 'module' object has no attribute 'CreateStructuringElementEx'

Why? Where I could see the differences between the versions?


Solution

  • In OpenCV 3 you should use:

    cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(9,9))
    

    Have a look at OpenCV Python tutorials on morphological operations