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 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献