0
votes

Good morning!

I'm working on a project of face recognition using java but I got this error on FaceRecognizer class:

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.compa.opencv.nativec.FisherFaceRecognizerID.createFisherFaceRecognizer_1()J
    at com.compa.opencv.nativec.FisherFaceRecognizerID.createFisherFaceRecognizer_1(Native Method)
    at com.compa.opencv.nativec.FisherFaceRecognizerID.<init>(FisherFaceRecognizerID.java:15)
    at com.compa.opencv.PlayMain.createRecognizer(PlayMain.java:128)
    at com.compa.opencv.PlayMain.cameraRecognize(PlayMain.java:88)
    at com.compa.opencv.PlayMain.main(PlayMain.java:33)

I have tried the solutions in these below links but it didn't work :s

Getting 'java.lang.UnsatisfiedLinkError': no lwjgl in java.library.path

Exception in thread "main" java.lang.UnsatisfiedLinkError: no openalprjni in java.library.path

Exception in thread "main" java.lang.UnsatisfiedLinkError"

Here is the part of the code which contains the error:

package com.compa.opencv.nativec;

import org.opencv.contrib.FaceRecognizer;

public class FisherFaceRecognizerID extends FaceRecognizer{

    private static native long createFisherFaceRecognizer_1();

    private static native long createFisherFaceRecognizer_1(int num_components);

    private static native long createFisherFaceRecognizer_2(int num_components,
            double threshold);

    public FisherFaceRecognizerID() {
        super(createFisherFaceRecognizer_1());
    }

    public FisherFaceRecognizerID(int num_components) {
        super(createFisherFaceRecognizer_1(num_components));
    }

    public FisherFaceRecognizerID(int num_components, double threshold) {
        super(createFisherFaceRecognizer_2(num_components, threshold));
    }

}

Full code here: https://www.dropbox.com/s/pa415f6lz3zbco7/DemoFaceRecognize-master%20%282%29.zip?dl=0

I would be grateful with any kind of help.

2

2 Answers

1
votes

Looks to me like you are using a third party face recognition library that depends on a native binary.

You have to add those native binaries in your class path e.g. (*.dll files in windows, or *.so in unix or linux)

UnsatisfiedLinkError - usually means a Java Native Interface (JNI) call where it fails to locate the native binary files.

Here is a screenshot on eclipse where you can see a Native Library in the source and you can click Edit and select the folder where your DLL or so files are. Here is a screen on eclipse project properties

0
votes

This is the temporary solution that I found:

In the main java file right click --> Properties --> Run/Debug settings --> Choose the main java file and click on Edit --> Arguments --> In the VM arguments field enter the following:

-Djava.library.path="C:\Program Files\Java\opencv2.4.13\build\java\x64; C:\Program Files\Java\opencv2.4.13\build\x64\vc12\bin" 

Which will point to the path of the dll files, but unfortunately it didn't work with me :(

Does anyone have any different suggestions?