【问题标题】:Setting up OpenCV Java bindings on OS X在 OS X 上设置 OpenCV Java 绑定
【发布时间】:2015-03-02 15:57:24
【问题描述】:

我正在按照此处的说明设置 OpenCV 以进行 Java 开发。 http://docs.opencv.org/trunk/doc/tutorials/introduction/desktop_java/java_dev_intro.html。 我正在使用带有 Java 1.8.0_25 的 Mac OS X 10.10.1。

我无法使用 cmake 将 Java 添加到“待构建”列表中,这是创建 Java 开发所需的与 Java 链接的本机库和 jar 文件的先决条件。

我收到的警告如下。我不知道如何解释此输出,也不知道是否需要对警告做出响应。错误中没有提到 Java。任何人都可以帮助我超越这个阶段吗?

[注意:我在 OpenCV 论坛上问过这个问题,但没有得到回复。]

CMake Warning (dev) at apps/haartraining/CMakeLists.txt:37 (add_library): Policy CMP0038 is not set: Targets may not link directly to themselves. Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Target "opencv_haartraining_engine" links to itself. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/haartraining/CMakeLists.txt:37 (add_library): Policy CMP0038 is not set: Targets may not link directly to themselves. Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Target "opencv_haartraining_engine" links to itself. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/haartraining/CMakeLists.txt:37 (add_library): Policy CMP0038 is not set: Targets may not link directly to themselves. Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Target "opencv_haartraining_engine" links to itself. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/haartraining/CMakeLists.txt:37 (add_library): Policy CMP0038 is not set: Targets may not link directly to themselves. Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Target "opencv_haartraining_engine" links to itself. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/haartraining/CMakeLists.txt:37 (add_library): Policy CMP0038 is not set: Targets may not link directly to themselves. Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Target "opencv_haartraining_engine" links to itself. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/haartraining/CMakeLists.txt:37 (add_library): Policy CMP0038 is not set: Targets may not link directly to themselves. Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Target "opencv_haartraining_engine" links to itself. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/haartraining/CMakeLists.txt:37 (add_library): Policy CMP0038 is not set: Targets may not link directly to themselves. Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Target "opencv_haartraining_engine" links to itself. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/haartraining/CMakeLists.txt:37 (add_library): Policy CMP0038 is not set: Targets may not link directly to themselves. Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Target "opencv_haartraining_engine" links to itself. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/haartraining/CMakeLists.txt:37 (add_library): Policy CMP0038 is not set: Targets may not link directly to themselves. Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Target "opencv_haartraining_engine" links to itself. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/haartraining/CMakeLists.txt:37 (add_library): Policy CMP0038 is not set: Targets may not link directly to themselves. Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Target "opencv_haartraining_engine" links to itself. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev): Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake --help-policy CMP0042" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

MACOSX_RPATH is not specified for the following targets:

opencv_python

This warning is for project developers. Use -Wno-dev to suppress it.

【问题讨论】:

    标签: java opencv video-capture


    【解决方案1】:

    我建议使用Homebrew 安装 OpenCV。它可以让你免于很多麻烦。安装Homebrew 后,只需输入这两行即可。 (ffmpeg 是可选的,我需要它用于视频)

    brew tap homebrew/science
    brew install opencv --with-ffmpeg --with-java
    

    之后,您只需在此位置添加文件:

    /usr/local/Cellar/opencv/VERSION_NUMBER/share/OpenCV/java 
    

    到你的项目。

    别忘了在你的代码中加载这个库:

    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    

    【讨论】:

      猜你喜欢
      • 2014-07-27
      • 1970-01-01
      • 2013-07-27
      • 2012-11-08
      • 2013-11-09
      • 1970-01-01
      • 2014-05-06
      • 1970-01-01
      相关资源
      最近更新 更多