Ask Your Question

catnipper's profile - activity

2016-05-23 08:48:39 -0500 answered a question OpenCV 3.0.0, FaceRecognizer and Python Bindings

Please delete - was a compile issue! **Running cmake the following way did solve the issue: cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D OPENCV_EXTRA_MODULES_PATH=/tmp/opencvBuild/opencv_contrib/modules /tmp/opencvBuild/opencv

Same for me (on CentOS release 6.4, Python 2.6.6):

  • Download OpenCV 3.1.0 and modules (opencv-contrib)
  • Copy face module to "modules"
  • Run cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON .. Run make
  • Check modules/python2/pyopencv_generated_types.h

static void pyopencv_face_BasicFaceRecognizer_specials(void) { pyopencv_face_BasicFaceRecognizer_Type.tp_base = &pyopencv_face_FaceRecognizer_Type; pyopencv_face_BasicFaceRecognizer_Type.tp_dealloc = pyopencv_face_BasicFaceRecognizer_dealloc; pyopencv_face_BasicFaceRecognizer_Type.tp_repr = pyopencv_face_BasicFaceRecognizer_repr; pyopencv_face_BasicFaceRecognizer_Type.tp_getset = pyopencv_face_BasicFaceRecognizer_getseters; pyopencv_face_BasicFaceRecognizer_Type.tp_methods = pyopencv_face_BasicFaceRecognizer_methods; } static void pyopencv_face_LBPHFaceRecognizer_specials(void) { pyopencv_face_LBPHFaceRecognizer_Type.tp_base = &pyopencv_face_FaceRecognizer_Type; pyopencv_face_LBPHFaceRecognizer_Type.tp_dealloc = pyopencv_face_LBPHFaceRecognizer_dealloc; pyopencv_face_LBPHFaceRecognizer_Type.tp_repr = pyopencv_face_LBPHFaceRecognizer_repr; pyopencv_face_LBPHFaceRecognizer_Type.tp_getset = pyopencv_face_LBPHFaceRecognizer_getseters; pyopencv_face_LBPHFaceRecognizer_Type.tp_methods = pyopencv_face_LBPHFaceRecognizer_methods; }

  • Run make install
  • Put site-packages/cv2.so into place

[root@esjdf build]# python Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import cv2 print help(cv2.face) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'face'

Thank's for helping!