0

I m trying to develop a face recognition system in raspberry pi so i downloaded opencv for python using "apt-get python-opencv" it downloded opencv 2.4.1 and now when i m using "recogniser=createLBPHFaceRecogniser()" it is showing error.

"Traceback(most recent call last):

File "", line 1, n

recogniser=createLBPHFaceRecogniser()

NameError: name 'createLBPHFaceRecogniser()' is not defined"

Blutbad
  • 56
  • 7

2 Answers2

0

Could it be that you did not import cv2?

import cv2

recogniser = cv2.createLBPHFaceRecognizer()

Also it looks like you have a typo in function name. (createLBPHFaceRecogniser instead of createLBPHFaceRecognizer)

Pavel Ryvintsev
  • 968
  • 1
  • 6
  • 20
  • i did..i importes cv2... actually the same code is working great in macbook with opencv 2.4.12 but not in raspberrypi i think it may be because of older version of opencv(2.4.1) may be it doesn't have that module. but i need a second opinion may be i m wrong somehow. – Blutbad Apr 10 '16 at 10:24
  • and the typo is in this question in actual code i have written 'Recognizer' – Blutbad Apr 12 '16 at 03:28
  • It could be that the binary provided with the apt-get repository was not compiled the module you need to use this function I have compiled opencv2 from source code using this article an the function is available: http://www.pyimagesearch.com/2015/02/23/install-opencv-and-python-on-your-raspberry-pi-2-and-b/ It is a little bit long, but detailed and provides step by step guide – Pavel Ryvintsev Apr 12 '16 at 06:24
0

try using For on opencv3.3.0

recognizer = cv2.face.LBPHFaceRecognizer_create()
Durodola Opemipo
  • 319
  • 2
  • 12