Can the package "org.opencv.core.Mat" be used for a simple Java program?

I am trying to perform some matrix operations in Java using opencv. I am using the Eclipse Kepler IDE.

The problem occurs when I try to declare a new matrix with a constructor, after which the following error appears in the console:

Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(III)J at org.opencv.core.Mat.n_Mat(Native Method) at org.opencv.core.Mat.<init>(Mat.java:477) 

I am using OpenCV 2.4.8 for OSX, OSX 10.9.1 and Eclipse Kepler.

Here is my code:

 import java.util.ArrayList; import java.util.List; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.core.Size; public class FisherFaces { public static void main(String[] args) { Size s = new Size(new double[] {3,3}); Mat g= new Mat(3,3,CvType.CV_8UC1); } 

Is there something I'm doing wrong to cause this error?

+6
source share
1 answer

I found the problem, I did not load my own libraries, adding that the line below fixes it.

 System.loadLibrary(Core.NATIVE_LIBRARY_NAME); 
+11
source

All Articles