Search code examples
opencvprocessing

UnsatisfiedLinkError using opencv for processing


I'm calling:

Mat opencv_K= new Mat(3, 3, CvType.CV_32F);

in a Processing sketch and I'm getting the following error:

java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(III)J
    at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:480)
    at java.lang.Thread.run(Thread.java:745)
UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(III)J
A library relies on native code that's not available.
Or only works properly when the sketch is run as a 32-bit application.

This error seems to me different from the one reported here.

A minimal example is:

import processing.core.PVector;
import org.opencv.core.Mat;
import org.opencv.core.CvType; 
import org.opencv.core.Core;
Mat opencv_K= new Mat(3, 3, CvType.CV_32F); 

And the error in this case is somewhat similar:

UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(III)J
A library relies on native code that's not available.
Or only works properly when the sketch is run as a 32-bit application.

I'm using Processing 3 in an Ubuntu platform.


Solution

  • Solution:

    Just add System.loadLibrary(Core.NATIVE_LIBRARY_NAME); before the relevant code