java使用opencv处理图片,idea运行程序,报错异常信息:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java490 in java.library.path: /Users/carter/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2429)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
at java.base/java.lang.System.loadLibrary(System.java:1989)
at org.jeecg.test.PanoramaStitching6.<clinit>(PanoramaStitching6.java:16)
Process finished with exit code 1
异常情况如下图所示:
1、异常情况分析
需要加载opencv库,看很多资料给出建议是System.loadLibrary(Core.NATIVE_LIBRARY_NAME),但是任然出现错误异常。
static {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
}
2、解决方案
引入maven依赖,加载opencv java库Loader.load(opencv_java.class)。
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv-platform</artifactId>
<version>4.9.0-1.5.10</version>
</dependency>
static {
Loader.load(opencv_java.class);
// System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
}
关键代码截图:
3.相关大数据学习demo地址:
https://github.com/carteryh/big-data