• <legend id='Kv1eW'><style id='Kv1eW'><dir id='Kv1eW'><q id='Kv1eW'></q></dir></style></legend>

      <small id='Kv1eW'></small><noframes id='Kv1eW'>

    1. <i id='Kv1eW'><tr id='Kv1eW'><dt id='Kv1eW'><q id='Kv1eW'><span id='Kv1eW'><b id='Kv1eW'><form id='Kv1eW'><ins id='Kv1eW'></ins><ul id='Kv1eW'></ul><sub id='Kv1eW'></sub></form><legend id='Kv1eW'></legend><bdo id='Kv1eW'><pre id='Kv1eW'><center id='Kv1eW'></center></pre></bdo></b><th id='Kv1eW'></th></span></q></dt></tr></i><div id='Kv1eW'><tfoot id='Kv1eW'></tfoot><dl id='Kv1eW'><fieldset id='Kv1eW'></fieldset></dl></div>

      <tfoot id='Kv1eW'></tfoot>
      • <bdo id='Kv1eW'></bdo><ul id='Kv1eW'></ul>

        如何使用命令行在 Linux 下使用 Java 构建 OpenCV?(将

        时间:2023-09-27

        1. <legend id='uSCYH'><style id='uSCYH'><dir id='uSCYH'><q id='uSCYH'></q></dir></style></legend>
            <tbody id='uSCYH'></tbody>

          <small id='uSCYH'></small><noframes id='uSCYH'>

          <tfoot id='uSCYH'></tfoot>

              <i id='uSCYH'><tr id='uSCYH'><dt id='uSCYH'><q id='uSCYH'><span id='uSCYH'><b id='uSCYH'><form id='uSCYH'><ins id='uSCYH'></ins><ul id='uSCYH'></ul><sub id='uSCYH'></sub></form><legend id='uSCYH'></legend><bdo id='uSCYH'><pre id='uSCYH'><center id='uSCYH'></center></pre></bdo></b><th id='uSCYH'></th></span></q></dt></tr></i><div id='uSCYH'><tfoot id='uSCYH'></tfoot><dl id='uSCYH'><fieldset id='uSCYH'></fieldset></dl></div>

                <bdo id='uSCYH'></bdo><ul id='uSCYH'></ul>

                  本文介绍了如何使用命令行在 Linux 下使用 Java 构建 OpenCV?(将在 MapReduce 中使用它)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  最近我正在为我的毕业项目尝试 OpenCV.我在 Windows 环境下取得了一些成功.并且因为 OpenCV 的 Windows 包附带了预构建的库,所以我不必担心如何构建它们.但是由于该项目假设运行在一个集群上,每个节点都使用 CentOS 作为主机操作系统,所以我必须知道如何正确编译,并在 Linux 环境下运行这些库.

                  Recently I'm trying OpenCV out for my graduation project. I've had some success under Windows enviroment. And because with Windows package of OpenCV it comes with pre-built libraries, so I don't have to worry about how to build them. But since the project is suppose to run on a cluster with CentOS as host OS for each node, I have to know how to correctly compile, and run these library under Linux enviroment.

                  我已经使用 VirtualBox 设置了一个 VM,并在其上安装了 Ubuntu 13.04.但到目前为止,我仍然找不到调整 CMakeList 设置以使 Java 成为构建目标的方法.(一个 jar 和一个本地库,因此我可以在 MapReduce 程序中导入和使用它们)以下是OpenCV桌面Java官方教程

                  I've set up a VM with VirtualBox and installed Ubuntu 13.04 on it. But so far I still can't find a way to adjust the settings of CMakeList to make Java a build target. (A jar, and a native library so I can import and use them in MapReduce program) Following is the official tutorial of desktop Java for OpenCV

                  http://docs.opencv.org/doc/tutorials/介绍/desktop_java/java_dev_intro.html

                  关于编译的部分非常简短.所以我还是不太明白.是因为我错过了对 Java 的一些依赖吗?我已经安装了 JVM(Jre-7u7).还是因为我没有正确配置CMakeList.txt?

                  The part about the compiling is pretty brief. So I still can't quite understand it. Is it because I missed some dependency for Java? I've already got JVM(Jre-7u7) installed. Or is it because I didn't configure CMakeList.txt correctly?

                  这是我到目前为止所做的事情,除了它是一个完全干净的 Ubuntu

                  Here is the things I've done so far, other than that it's a complete clean Ubuntu

                  1. 安装的vim
                  2. 已安装 g++
                  3. 已安装 cmake
                  4. 安装了 cmake-curses-gui
                  5. 已安装 java7 JVM
                  6. 下载适用于 Linux 的 OpenCV 包

                  目标环境为CentOS集群,每个节点的宿主操作系统为CentOS,项目为MapReduce程序.

                  The target enviroment is Cluster with CentOS as host OS for each node, and the project is a MapReduce program.

                  提前致谢.

                  推荐答案

                  可能你缺少的是 ant,它是一个面向 java 的构建工具.

                  Probably what you're missing is ant, which is a java oriented build tool.

                  你去的时候:

                  cmake -D BUILD_SHARED_LIBS=OFF ../opencv-2.4.5/
                  

                  (即您为机器配置 make 的位置),检查是否有 java 部分.它应该这样说(可能有不同的路径/版本):

                  (i.e. where you're configuring the make for your machine), check for the section that says java. It should say something like this (possibly with different paths/versions):

                  --   Java:
                  --     ant:                         /usr/bin/ant (ver 1.8.2)
                  --     JNI:                         /usr/lib/jvm/java-6-openjdk/include /usr/lib/jvm/java-6-openjdk/include /usr/lib/jvm/java-6-openjdk/include
                  --     Java tests:                  YES
                  

                  当我第一次运行 cmake 时,我有这个:

                  When I first ran cmake, I had this:

                  --   Java:
                  --     ant:                         NO
                  --     JNI:                         NO
                  --     Java tests:                  YES
                  

                  这表明它找不到 ant,因此它没有创建 .jar 文件.我只是使用存储库中的版本:

                  Which indicated it couldn't find ant, and so it didn't create a .jar file. I simply use the version that's in the repository:

                  sudo apt-get install ant
                  

                  我再次运行 cmake,使用上述选项,得到了 ant 的路径(我免费获得了 JNI!).

                  I ran cmake again, with the above options, which got the path to ant (and I got JNI for free!).

                  注意:您可能需要相当仔细地阅读 cmake 的输出,因为它会告诉您它将在您的机器上构建什么,并且您可能缺少一些库.

                  Note: You probably want to read the output of cmake fairly carefully as it tells you what it's going to build on your machine, and you may have some missing libraries.

                  如果您发现 JNI 仍然丢失.

                  cmake是(主要是?首先?方便?可以解释为?)寻找jni.h,具体应该是$JAVA_HOME/include/jni.h 所以需要设置$JAVA_HOME到你的 jdk 的主文件夹.

                  cmake is (mostly? first? conveniently? can be interpreted as?) looking for jni.h, which should be specifically $JAVA_HOME/include/jni.h So you need to set $JAVA_HOME to the home folder of your jdk.

                  我使用 which javacls -l 来跟踪一系列符号链接,以识别我的 java 1.7 安装位置.您也可以使用 locate jni.h 并查找树,或者简单地查看 /usr/lib/jvm 或类似内容.

                  I used which javac and then ls -l to follow a series of symbolic links, to identify where my java 1.7 install was. You could also use locate jni.h and work up the tree, or simply look around /usr/lib/jvm or similar.

                  export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
                  

                  你可能想用几个来检查你是否正确

                  You probably want to check that you've got that right with a couple of

                  ls $JAVA_HOME/bin/javac
                  /usr/lib/jvm/java-7-openjdk-amd64/bin/javac
                  
                  ls $JAVA_HOME/include/jni.h
                  /usr/lib/jvm/java-7-openjdk-amd64/include/jni.h
                  

                  有趣的是,当我再次运行 cmake 命令时,它选择了一个不同的 JNI 文件夹:

                  Interestingly when I ran the cmake command again, it picked up a different JNI folder:

                  --     JNI:                         /usr/lib/jvm/java-7-openjdk-amd64/include /usr/lib/jvm/java-7-openjdk-amd64/include /usr/lib/jvm/java-7-openjdk-amd64/include
                  

                  完成后,运行 make 命令.如果您着迷地观看,您会看到一堆 .java 文件滚过.无论哪种方式,您最终都会在 ./bin 文件夹中得到一个 .jar 文件.(在我的例子中,它被称为 opencv-245.jar 因为这是我下载的代码版本).

                  Once you've got that, run the make command. If you watch obsessively, you'll see a bunch of .java files trundle past. Either way you'll end up with a .jar file in the ./bin folder. (in my case it's called opencv-245.jar as that's the version of the code I downloaded).

                  这篇关于如何使用命令行在 Linux 下使用 Java 构建 OpenCV?(将在 MapReduce 中使用它)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Yarn MapReduce 作业问题 - Hadoop 2.3.0 中的 AM 容器启动 下一篇:如何从spark中的hbase表中获取所有数据

                  相关文章

                  最新文章

                  1. <small id='Tp9rb'></small><noframes id='Tp9rb'>

                      <bdo id='Tp9rb'></bdo><ul id='Tp9rb'></ul>
                      <i id='Tp9rb'><tr id='Tp9rb'><dt id='Tp9rb'><q id='Tp9rb'><span id='Tp9rb'><b id='Tp9rb'><form id='Tp9rb'><ins id='Tp9rb'></ins><ul id='Tp9rb'></ul><sub id='Tp9rb'></sub></form><legend id='Tp9rb'></legend><bdo id='Tp9rb'><pre id='Tp9rb'><center id='Tp9rb'></center></pre></bdo></b><th id='Tp9rb'></th></span></q></dt></tr></i><div id='Tp9rb'><tfoot id='Tp9rb'></tfoot><dl id='Tp9rb'><fieldset id='Tp9rb'></fieldset></dl></div>
                      <tfoot id='Tp9rb'></tfoot>
                    1. <legend id='Tp9rb'><style id='Tp9rb'><dir id='Tp9rb'><q id='Tp9rb'></q></dir></style></legend>