ww23 / BlindWatermark

Java 盲水印
Apache License 2.0
418 stars 106 forks source link

no opencv_imgproc343 in java.library.path #1

Closed aaronwong1989 closed 6 years ago

aaronwong1989 commented 6 years ago

我执行java命令时增加的参数 -Djava.library.path=D:/app/opencv/java/x64 我的dll文件都这这个目录

  public static void main(String[] args) {
    SpringApplication.run(BlindWatermarkApplication.class, args);
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    loadOpenCvTest();
    Loader.load(opencv_core.class);
  }

  public static void loadOpenCvTest() {
    Mat mat = Mat.eye(3, 3, CvType.CV_8UC1);
    logger.info("opencv load success ! \n" + mat.dump());
  }

这是我的java代码,第一种方式的测试可以通过,但是运行到load方法就报错,请问时什么原因?

2018-11-28 17:10:06.324  INFO 20216 --- [           main] c.c.z.b.BlindWatermarkApplication        : opencv load success ! 
[  1,   0,   0;
   0,   1,   0;
   0,   0,   1]
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1258)
    at org.bytedeco.javacpp.Loader.load(Loader.java:999)
    at org.bytedeco.javacpp.Loader.load(Loader.java:891)
    at org.bytedeco.javacpp.opencv_core.<clinit>(opencv_core.java:10)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.bytedeco.javacpp.Loader.load(Loader.java:950)
    at org.bytedeco.javacpp.Loader.load(Loader.java:907)
    at cn.com.zybank.blindwatermark.BlindWatermarkApplication.main(BlindWatermarkApplication.java:27)
Caused by: java.lang.UnsatisfiedLinkError: no opencv_imgproc343 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1258)
    at org.bytedeco.javacpp.Loader.load(Loader.java:977)
    ... 7 more
ww23 commented 6 years ago

1.尝试将依赖改为org.bytedeco:javacv-platform:1.4.3 2.尝试增加参数-Djavacpp.platform.dependencies=true 3.参考https://github.com/bytedeco/javacpp-presets/wiki/Debugging-UnsatisfiedLinkError-on-Windows

aaronwong1989 commented 6 years ago

default

兄弟还是报错,你自己时怎么跑起来的?

aaronwong1989 commented 6 years ago

可以帮我看下嘛 https://github.com/aaronwong1989/blind-watermark

ww23 commented 6 years ago

1.依赖改为:

<dependency>
  <groupId>org.bytedeco</groupId>
  <artifactId>javacv-platform</artifactId>
  <version>1.4.2</version>
</dependency>

2.Mat 引用 opencv_core 下的 Mat 3.使用 javacv 不需要再 loadLibrary image

aaronwong1989 commented 6 years ago

多谢,搞清楚了,maven需要指定maven classifer。发自我的华为手机-------- 原始邮件 --------主题:Re: [ww23/BlindWatermark] no opencv_imgproc343 in java.library.path (#1)发件人:ww23 收件人:ww23/BlindWatermark 抄送:aaronwong1989 ,Author 1.依赖改为:

org.bytedeco javacv-platform 1.4.2

2.Mat 引用 opencv_core 下的 Mat 3.使用 javacv 不需要再 loadLibrary

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.