Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

java.lang.UnsatisfiedLinkError: org.opencv.imgcodecs.Imgcodecs.imread_0(Ljava/lang/String;I)J

Ask Question

I'm trying to do some operations with a Matrix in Java using opencv. I'm using Netbeans IDE.

The problem happens when I try to declare a new matrix with the constructor, then I get the following error in the console:

Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.imgcodecs.Imgcodecs.imread_0(Ljava/lang/String;I)J
at org.opencv.imgcodecs.Imgcodecs.imread_0(Native Method)
at org.opencv.imgcodecs.Imgcodecs.imread(Imgcodecs.java:93)
at imagecomparator.Mini.compareFeature(Mini.java:62)
at imagecomparator.Mini.main(Mini.java:37)

Java Result: 1

My Code is as the following :

public static int compareFeature(String filename1, String filename2) throws IOException {
    int retVal = 0;
    long startTime = System.currentTimeMillis();
    System.out.println(System.getProperty("java.library.path")); 
    System.load( "C:\\Windows\\System32\\opencv_java310.dll" );
  // Load images to compare
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME); 
    Mat img1  = Imgcodecs.imread(filename1, Imgcodecs.CV_LOAD_IMAGE_COLOR);
    Mat img2  = Imgcodecs.imread(filename2, Imgcodecs.CV_LOAD_IMAGE_COLOR);

Is there anything I am doing wrong to cause this error?

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.