handy icon indicating copy to clipboard operation
handy copied to clipboard

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

Open RoConverse opened this issue 5 years ago • 13 comments

RoConverse avatar May 19 '19 04:05 RoConverse

Try installing opencv-contrib-python. command: pip install opencv-contrib-python

vijayjadhav008 avatar Aug 15 '19 05:08 vijayjadhav008

I get the same after after installing opencv-contrib! What should I do?

KeerthanaThirumoorthy avatar Oct 23 '19 10:10 KeerthanaThirumoorthy

any fixes ?

sujitshodangi avatar Mar 27 '20 06:03 sujitshodangi

Traceback (most recent call last): File "app.py", line 9, in faceCascade = cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml") AttributeError: module 'cv2' has no attribute 'data'

sujitshodangi avatar Mar 27 '20 06:03 sujitshodangi

Sir What about its data set?

abdulwahab215-ux avatar Jul 25 '20 03:07 abdulwahab215-ux

Change it to: faceCascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")

souravrs999 avatar Jul 28 '20 05:07 souravrs999

I had the same issue, this solved it for me: pip install opencv-contrib-python --upgrade

CallShaul avatar Aug 18 '20 16:08 CallShaul

Thanks @CallShaul! This fixed it for me too.

Rephil2 avatar Nov 03 '20 13:11 Rephil2

having installed both python-opencv and opencv-contrib-python may cause some problems in the same environment (https://pypi.org/project/opencv-contrib-python/) be sure to uninstall before 1 before installing the other

zanivanusa avatar Dec 13 '20 06:12 zanivanusa

detector = cv2.cascadeClassifier(haarcascadePath) AttributeError: module 'cv2' has no attribute 'cascadeClassifier' I am getting this . Can anyone fix this ?

palakchanana avatar Jan 05 '22 07:01 palakchanana

detector = cv2.cascadeClassifier(haarcascadePath) AttributeError: module 'cv2' has no attribute 'cascadeClassifier' I am getting this . Can anyone fix this ?

It's Cascade classifier 'C' should be capitalized just a typo

souravrs999 avatar Jan 05 '22 07:01 souravrs999

I have pip uninstalled opencv-python and installed opencv-contrib-python but I still get this error.

This is the line with the problem: face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')

usernames-privacy avatar Sep 28 '23 15:09 usernames-privacy

@usernames-privacy am also facing the same issue. But i think the problem might stem from the cascade file not been available in the cv folder.

kekeli3k avatar Dec 23 '23 09:12 kekeli3k