OpenCv 3.0.0 Face Recognizer with Java

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 00:38:53

问题


I'm writing this post to ask how I can use Face Recognizer in a JAVA project. I'm trying to generate with cmake the jar file of opencv3.0.0.0 with all its contribs, but the resulted generated jar contains only standard modules. I've also tried to use the 2.4.11 version but i can't realize how to make a concrete instance of the face recognizer class.


回答1:


The one part that is a bit tricky to find in any documentation is about editing the CMakeLists.txt for the contrib modules. It seems that is the only part you are missing, but I have included the full step-by-step process below for others.

  1. Download/clone opencv repository found here
  2. Download/clone opencv_contrib repository found here
  3. Go to opencv_contrib/modules/face and edit CMakeLists.txt
  4. Find the line that begins with ocv_define_module and add "java" so that it looks something like this:

    ocv_define_module(face opencv_core opencv_imgproc opencv_objdetect WRAP python java)

  5. Compile opencv with contrib modules as normal, i.e. adding the appropriate parameters to cmake as follows:

    cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_EXTRA_MODULES_PATH=<path to opencv_contrib>

  6. The JAR built in the bin/ folder will now contain the org.opencv.face package



来源:https://stackoverflow.com/questions/34224468/opencv-3-0-0-face-recognizer-with-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!