Reputation: 11
I'm getting the error instead of installing all the dependencies like python3.6, numpy, opencv, open-contrib-python.
I've tried to upgrade opencv.
import cv2
from cv2 import *
import numpy as np
import sqlite3
import os
conn = sqlite3.connect('database.db')
c = conn.cursor()
fname = "recognizer/trainingData.yml"
if not os.path.isfile(fname):
print("Please train the data first")
exit(0)
face_cascade =
cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
cap = cv2.VideoCapture(0)
recognizer = cv2.face.LBPHFaceRecognizer_create()
recognizer.read(fname)
Error message
AttributeError: module 'cv2.cv2' has no attribute 'face'
Upvotes: 1
Views: 688
Reputation: 446
I have same problem. And here is how I solve the problem.
1) opencv-contrib and opencv must have the exactly same version.
2) I have 4.1.2.30 version for both opencv and I still get the error. After that I changed the version of them. I am using 3.4.8.29 version for the both opencv. Thats solve my problem.
I hope it will work!
Upvotes: 1