Using JavaCV with Kotlin

前端 未结 3 1322
感情败类
感情败类 2021-01-23 11:06

I\'m currently attempting to start a project using JavaCV in Kotlin. I\'m using IntelliJ Idea as my IDE. I\'m using JavaCV 1.3.2 and OpenCV 3.20. This is my setup for the modul

3条回答
  •  甜味超标
    2021-01-23 11:56

    on MacOS, you don't need to install a native library. On OpenCV3.41, as fetched from

    
        
          org.openpnp
          opencv
          3.4.2-1
        
    

    I looked in the library (jar tf ~/.m2/repository/org/openpnp/opencv/3.4.2-1/opencv-3.4.2.-1.jar) and found dlls and whatnot in it:

    jar tf *1.jar | grep nu
    ...
    nu/pattern/opencv/osx/
    nu/pattern/opencv/osx/x86_64/
    nu/pattern/opencv/osx/x86_64/README.md
    nu/pattern/opencv/osx/x86_64/cmake.log
    nu/pattern/opencv/osx/x86_64/libopencv_java342.dylib
    ...
    

    This led me to this StackOverflow question on nu.pattern which show how to use the nu.pattern in code.

    static {
        nu.pattern.OpenCV.loadShared();
        System.loadLibrary(org.opencv.core.Core.NATIVE_LIBRARY_NAME);
    }
    

    This prologue code enabled sample apps which used to fail as above to run.

提交回复
热议问题