问题描述
我正在写这篇文章,问我如何在JAVA项目中使用Face Recognizer.我正在尝试使用cmake生成带有所有贡献的opencv3.0.0.0的jar文件,但是生成的生成的jar仅包含标准模块.我也尝试过使用2.4.11版本,但是我不知道如何制作人脸识别器类的具体实例.
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.
推荐答案
在任何文档中都很难找到的一部分是关于编辑contrib模块的CMakeLists.txt.看来这是您唯一缺少的部分,但是我在下面为其他人提供了完整的分步过程.
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.
- 在此处 下载/克隆opencv存储库
- 在此处 处下载/克隆opencv_contrib存储库
- 转到opencv_contrib/modules/face并编辑CMakeLists.txt
-
找到以ocv_define_module开头的行,并添加"java",使其看起来像这样:
- Download/clone opencv repository found here
- Download/clone opencv_contrib repository found here
- Go to opencv_contrib/modules/face and edit CMakeLists.txt
Find the line that begins with ocv_define_module and add "java" so that it looks something like this:
使用contrib模块编译opencv 正常,即向cmake添加适当的参数,如下所示:
Compile opencv with contrib modules as normal, i.e. adding the appropriate parameters to cmake as follows:
bin/文件夹中内置的JAR现在将包含org.opencv.face包
The JAR built in the bin/ folder will now contain the org.opencv.face package
这篇关于带有Java的OpenCv 3.0.0人脸识别器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!