mmmmPccPcc 2017-04-07 14:26 采纳率: 0%
浏览 1631

JNI调用dll,报错dll中找不到函数


I am tring to use opencv and java for face detection, and in that pursit i found this "JNI2OPENCV" file....but i am confused on how to make it work, can anyone help me?

http://img519.imageshack.us/img519/4803/askaj.jpg

and the following is the FaceDetection.java

class JNIOpenCV {
    static {
        System.loadLibrary("JNI2OpenCV");
    }
    public native int[] detectFace(int minFaceWidth, int minFaceHeight, String cascade, String filename);
}

public class FaceDetection {
    private JNIOpenCV myJNIOpenCV;
    private FaceDetection myFaceDetection;

    public FaceDetection() {
        myJNIOpenCV = new JNIOpenCV();
        String filename = "lena.jpg";
        String cascade = "haarcascade_frontalface_alt.xml";

    int[] detectedFaces = myJNIOpenCV.detectFace(40, 40, cascade, filename);
    int numFaces = detectedFaces.length / 4;

        System.out.println("numFaces = " + numFaces);
        for (int i = 0; i < numFaces; i++) {
            System.out.println("Face " + i + ": " + detectedFaces[4 * i + 0] + " " + detectedFaces[4 * i + 1] + " " + detectedFaces[4 * i + 2] + " " + detectedFaces[4 * i + 3]);
        }
    }

    public static void main(String args[]) {
        FaceDetection myFaceDetection = new FaceDetection();   
    }
}

Exception in thread "main" java.lang.UnsatisfiedLinkError: FaceDetection.JNIOpenCV.detectFace(IILjava/lang/String;Ljava/lang/String;)[I
at FaceDetection.JNIOpenCV.detectFace(Native Method)
at FaceDetection.FaceDetection.(FaceDetection.java:19)
at FaceDetection.FaceDetection.main(FaceDetection.java:29)
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)


  • 写回答

1条回答 默认 最新

  • threenewbee 2017-04-07 14:57
    关注

    检查你的函数名、参数列表、调用约定、参数类型

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog