Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(III)J?

I've been trying to get opencv working inside of our raspberry pi, but I have not been able to get it working at all. I made a new eclipse project, added in the OpenCV library, and pasted in some super simple code.

import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;

public class Hello
{
   public static void main( String[] args )
   {
      System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
      Mat mat = Mat.eye( 3, 3, CvType.CV_8UC1 );
      System.out.println( "mat = " + mat.dump() );
   }
}

But I am getting the error:

java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(III)J

Is there anyway to solve this error? I am out of ideas.

like image 416
ariagno Avatar asked Dec 08 '22 19:12

ariagno


1 Answers

The error you are getting means that the native OpenCV file has not been linked/loaded.

  System.loadLibrary( Core.NATIVE_LIBRARY_NAME );

The line of code above that you are using, will work only if the specified OpenCV native file resides inside the Java library path.

Are you sure OpenCV files are there? I would suggest trying to load the OpenCV native by giving the full path, just to see where the problem lies.

System.load("fullPathTo/opencv.dll");

I would also recommend taking a look at this post which explains all these in detail. https://stackoverflow.com/a/47718273/5165833

like image 124
arxakoulini Avatar answered Dec 31 '22 06:12

arxakoulini