I am facing some attribute error while running face recognizing the code. My face detects code run perfectly.But while I try to run the face recognizing code it shows some a
I got openCV installed smoothly in my mac by:
$ brew install opencv
$ brew link --overwrite --dry-run opencv // to force linking
$ pip3 install opencv-contrib-python
I got it at windows 10 using:
c:\> pip3 install opencv-python
c:\> pip3 install opencv-contrib-python
Then I got it tested by
$ python3
Python 3.7.3 (default, Mar 27 2019, 09:23:15)
[Clang 10.0.1 (clang-1001.0.46.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.0'
>>> exit()
I had a similar problem:
module cv2 has no attribute "cv2.TrackerCSRT_create"
My Python version is 3.8.0 under Windows 10. The problem was the opencv version installation.
So I fixed this way (cmd prompt with administrator privileges):
pip uninstall opencv-python
pip install opencv-contrib-python
Anyway you can read the following guide:
https://github.com/skvark/opencv-python
I tried all of the different things but nothing seems to be working then I just restarted my IDE and it worked like charm.
Still, if it does not work then try restarting your system.
FYI, I am working on the following versions
opencv-contrib-python==4.4.0.46
opencv-python==4.1.2.30
Check your OpenCV version
import cv2
cv2.__version__
If your are running Python v3.x and OpenCV v4 and above:
pip install opencv-contrib-python
Try running your program again. This should now work.
You might be running Python3 and therefore you are supposed to use pip3 to install the opencv-contrib package :
pip3 install opencv-contrib-python
This worked for me.
For me changing createLBPHFaceRecognizer() to
recognizer = cv2.face.LBPHFaceRecognizer_create()
fixed the problem