How to fix 'cv2' has no attribute 'CascadeClassifier'?

Viewed 648

I just installed Spyder (Python 3.8) and in the Anaconda Prompt, i installed OpenCV, however while running the following statements:

import cv2 face_cascade = cv2.CascadeClassifier('haarcascade_frontalcatface.xml')

I receive as error: module 'cv2' has no attribute 'CascadeClassifier'.

Let me tell you that i've already downloaded 'haarcascade_frontalcatface.xml' file. Please help me to fix this problem. Thank you!

1 Answers

Strange. Did you install the latest version of OpenCV or the version which actually contains the implementation of this CascadeClassifier? Maybe, you could try running conda update opencv and see if it resolves the problem or not.

Related