有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

线程“main”java中出现异常。lang.unsatifiedlinkerror:org。opencv。国际编码。国际编码。imread_0(Ljava/lang/String;I)J

我已经开始处理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) 个答案