Ask Your Question

Revision history [back]

confidace in facerecogniezer in opencv 3

Hello, this is my first question and i hope i will write it correctly here. Am currently working on face recognition using Opencv3, Python 3.5 and LBPH

all goes well till unknown picture appears, my code won't decide for it as unknown thus a random id will be set, the problem is with the confidence values since for some reason i can't get the confidence at all. i use this portion of code to find my prediction

id, conf = recognizer.predict(faceNp[y: y + h, x: x + w])

this will result in the following error

Traceback (most recent call last):
  File "Recognition.py", line 39, in <module>
    id, conf = recognizer.predict(faceNp[y: y + h, x: x + w])
TypeError: 'int' object is not iterable

and if i tried this

id, conf = recognizer.predict(faceNp[y: y + h, x: x + w])

it will work but i won't be able to label any face as -1 or do any further processing on the unknown faces i have looked in the previous question and i tried using

prediction, conf = self.application.recognizer.predict(test_image[y: y + h, x: x + w])

and it returned (couldn't solve this too )

Traceback (most recent call last):
  File "Recognition.py", line 39, in <module>
    id, conf = self.application.recognizer.predict(faceNp[y: y + h, x: x + w])
NameError: name 'self' is not defined

I wish i can find the answer and thanks for your time.