Android OpenCV imwrite找不到实现



我正试图在我的OpenCV Android应用程序中使用Imgcodecs.imwrite,但它一直给我错误:

No implementation found for boolean org.opencv.imgcodecs.Imgcodecs.imwrite_1(java.lang.String, long) (tried Java_org_opencv_imgcodecs_Imgcodecs_imwrite_11 and Java_org_opencv_imgcodecs_Imgcodecs_imwrite_11__Ljava_lang_String_2J)

我的代码是:

 private void takePhoto(final Mat rgba) {

        Imgproc.cvtColor(rgba, mBgr, Imgproc.COLOR_RGBA2BGR, 3);
        String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
        String fileName = "myFile.jpg";
        imageFile = new File(baseDir + File.separator + fileName);
        Imgcodecs.imwrite(imageFile.toString(), mBgr);

        final Intent intent = new Intent(this, LabActivity.class);
        intent.putExtra(LabActivity.EXTRA_PHOTO_DATA_PATH,
                imageFile.toString());
        startActivity(intent);
    }

非常感谢

我刚刚解决了它。版本应该声明如下:

OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0,

相关内容

  • 没有找到相关文章