Reputation: 9187
I need to integrate OpenCV 2.4 in my app.First, I found that it requires OpenCV Manager for running app based on OpenCV. But, After some googling, I found another way using static initialization here and here. I tried but it isn't working:
psudo code:
public class MainActivity extends Activity {
static {
if (!OpenCVLoader.initDebug()) {
Log.d(TAG,"init failed")
}
}
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS: {
Log.i(TAG, "OpenCV loaded successfully");
}
break;
default: {
super.onManagerConnected(status);
}
break;
}
}
};
@Override
public void onResume() {
super.onResume();
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_4, this,
mLoaderCallback);
}
}
I tried but this isn't working. It shows the same pop-up for installing openCV Manager.
I also tried to remove initAsync()
in onResume and mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS)
; but the app crashes when I use this.
Can anyone guide me to the proper way? and Please do not mark as duplicate; there are tens and hundreads of questions on SO unanswered.
Upvotes: 0
Views: 133
Reputation: 9187
I solved it to myself. You don't need to write .so
extension after JNI libraries.
I wrote this in incorrect way:
System.loadLibrary("lib1.so");
System.loadLibrary("lib2.so");
After all, I found the correct way:
System.loadLibrary("lib1");
System.loadLibrary("lib2");
As mentioned, don't need to write .so
extension.
Upvotes: 0
Reputation: 1634
If you using Android Studio check this: https://github.com/floatlearning/android-opencv-template Then, on Android device install a property OpenCV Manager
Upvotes: 1