Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm trying to do some operations with a Matrix in Java using opencv. I'm using Eclipse Kepler 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.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'm 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 anything I am doing wrong to cause this error?

like image 955
Richi Avatar asked Feb 04 '14 01:02

Richi


1 Answers

I found the problem, I wasn't loading the native libraries, adding the line below fixes it.

System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
like image 174
Richi Avatar answered Sep 24 '22 06:09

Richi