Reputation: 306
I want to execute a simple OpenCV code to test that the library is well loaded by Maven.
This is the code:
package helloworld;
import org.opencv.core.*;
public class Hello {
public static void main(String[] args)
{
nu.pattern.OpenCV.loadLibrary();
System.out.println("Hey World !");
Mat mat = Mat.eye(3, 3, CvType.CV_8UC1);
}
}
And this is the console output I get, with the two errors, when I try to run it:
java.lang.NoSuchFieldException: sys_paths at java.base/java.lang.Class.getDeclaredField(Class.java:2417) at nu.pattern.OpenCV.loadLibrary(OpenCV.java:207) at helloworld.Hello.main(Hello.java:9)
Hey World !
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_eye(III)J at org.opencv.core.Mat.n_eye(Native Method) at org.opencv.core.Mat.eye(Mat.java:1467) at helloworld.Hello.main(Hello.java:11)
I got the maven repository linking looking at that post.
Would you have any idea about what is causing that?
Thanks!
Upvotes: 1
Views: 2059
Reputation: 44
Try downloading a library from another repository.
<dependency>
<groupId>org.openpnp</groupId>
<artifactId>opencv</artifactId>
<version>3.4.2-1</version>
</dependency>
You can see my answer to the post with a similar problem.
Upvotes: 2