线程“主”中的异常java.lang.UnsatisfiedLinkError:org.opencv.imgcodecs.Imgcodecs.imread_0(Ljava / lang / String; I)J

时间:2018-08-07 11:17:20

标签: java opencv

我已经开始使用opencv库,并且在此代码中我希望进行人脸检测,但是它抛出了complie time错误,我还检查了本机库路径,并且还检查了给定文件是否存在,但当时imread()函数出现错误

预先感谢

    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    Mat mat = Mat.eye(3, 3, CvType.CV_8UC1);
    System.out.println("mat = " + mat.dump());

    CascadeClassifier faceDetector = new CascadeClassifier();
    faceDetector.load("C:\\opencv\\sources\\data\\haarcascades\\haarcascade_frontalface_default.xml");

    // Input image
    File file = new File("C:\\Users\\bill.jpg");
    if (file.exists()) {
        System.out.println("file found at  " + file.getAbsolutePath());
        // This is true
        Mat image = Imgcodecs.imread(file.getAbsolutePath(), Imgcodecs.CV_LOAD_IMAGE_COLOR); // file.getPath() also
                                                                                                // same

        MatOfRect faceDetections = new MatOfRect();
        faceDetector.detectMultiScale(image, faceDetections);
        for (Rect rect : faceDetections.toArray()) {
            Imgproc.rectangle(image, new Point(rect.x, rect.y),
                    new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
        }
    }


    String filename = "Ouput.jpg";
    // Imgcodecs.imwrite("D:\\"+filename, image);

0 个答案:

没有答案