2016-07-21 98 views
1

我想在我的OpenCV的Android應用程序使用Imgcodecs.imwrite但它不斷給我的錯誤:的Android OpenCV的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); 
    } 

非常感謝

+0

您正在使用哪種OpenCV版本?對於較早的版本,您需要'Highgui.imwrite' – Miki

+0

Latest,3.1。我被困了好幾個小時...... – Bran

回答

1

我剛纔已經解決了它。該版本應聲明如下:

OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0,