TypeError: 'cv2.face_EigenFaceRecognizer' object is not callable

269 Views Asked by At

I ran into an error which i do not know where and what is causing it. Please i need help.

def train(self,images,lables, recogType=0):
        self.images = images
        self.lables = np.array(lables)

        'arg = recogType:[cv2.face.LBPHFaceRecognizer_create(),cv2.face.FisherFaceRecognizer_create(),cv2.face.EigenFaceRecognizer_create()'
        recogs = cv2.face.LBPHFaceRecognizer_create(),cv2.face.FisherFaceRecognizer_create(),cv2.face.EigenFaceRecognizer_create()
        self.recognizer = recogs[recogType]()    
        self.recognizer.train(self.images,self.lables)
1

There are 1 best solutions below

0
doctorlove On BEST ANSWER

The specific problem is with this line:

self.recognizer = recogs[recogType]() 

By placing braces () on the end, you are trying to call the recognizer, as the error says. Change this to

self.recognizer = recogs[recogType]

//Disclaimer - there may be other problems.