Naj
Naj

Reputation: 31

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

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!

Upvotes: 3

Views: 1212

Answers (1)

Programmer
Programmer

Reputation: 71

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.

Upvotes: 0

Related Questions