UnsatisfiedLinkError: bitmapToMat on Android
I'm using android sdk , opencv4android, ndk, jni. I did static initialization and i checked loaded opencv_java. and now I use opencv api, but I can't use bitmapToMat API.. Help me.. Should I use like System.loadLibrary(Core.NATIVE_NAME_LIBRARY)?
Error Message
No implementation found for native Lorg/opencv/android/Utils;.nBitmapToMat2:(Landroid/graphics/Bitmap;JZ)V thread exiting with uncaught exception (group=0x41280ba0) FATAL EXCEPTION: main java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.android.Utils.nBitmapToMat2:(Landroid/graphics/Bitmap;JZ)V at org.opencv.android.Utils.nBitmapToMat2(Native Method) t org.opencv.android.Utils.bitmapToMat(Utils.java:93) at asia.ensobi.util.ImageUtil$FeatureDetector.findFacesRect(ImageUtil.java:134)
Flow
MainActivity -> Gallery(Third Party) -> FaceChoiceActivity -> ImageUtil (Error)
Source Code
- ImageUtils
<textarea rows="20" cols="80"> public class ImageUtil { static public void loadLibrary(String...libnames){ for( String libname : libnames){ System.loadLibrary(libname); } if(!OpenCVLoader.initDebug() ) { Log.d("ERROR", "Unable to load OpenCV"); } else { Log.d("SUCCESS", "OpenCV loaded"); }
} (...) public class (...){ (...) public ArrayList<rect> findFacesRect(Bitmap orgImage){ MatOfRect faces = new MatOfRect(); if ( mNativeDetector != null ){ Mat imageMat = new Mat(); Bitmap rgb555 = orgImage.copy(Bitmap.Config.RGB_565, true); Utils.bitmapToMat(rgb555, imageMat, true); // Error occured (...) } } (...) } </textarea> - FaceChoiceActivity
<textarea rows="20" cols="80"> public class FaceChoiceActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gallery); Intent intent = getIntent(); if (intent.hasExtra("Image")){ Uri photoUri = (Uri)intent.getParcelableExtra("Image"); Bitmap orgImage = null; try{ ContentResolver resolv = getContentResolver(); orgImage = MediaStore.Images.Media.getBitmap(resolv, photoUri); // Call ImageUtil.findFaces ArrayList<rect> facesArray = MainActivity.mFeatureDetector.findFacesRect(orgImage); (....) } (...) } </textarea>