1

Before Closing question: I've already gone thorough the other SO answers, but none of them showing how to fix this with Android Studio.

I am using opencv library to detect cards in my application. The Application is like Document scanner but it uses JavaCameraView instead of image bitmap.

mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.live_camera_frame);

My problem is, on using JavaCameraView it always asks for installing OpenCV Manager from play store.

Even After following the steps of openCV static initialization in android studio it is asking me for download openCV manage APK from playstore. I am using android studio 1.5 and opencv library 3.1.0

Can anyone please tell how to use OpenCV Camera without installing Opencv manager as standalone app?

As of summury, I dont want user to be prompted for dialog as in image. If we can include openCV library as a part of project and if we can use it without installation.

I followed steps here application-development-with-static-initialization but it is for eclipse and I am using android studio. I tried the same thing for eclipse but then it is giving error in standard openCV library that class not found.

Rajan Rawal
  • 6,171
  • 6
  • 40
  • 62
  • 1
    [check this link](http://stackoverflow.com/questions/36551069/using-android-opencv-apps-without-downloading-opencv-sdk-manager?rq=1) else if you have solved by another method.. please share.. –  Jul 04 '16 at 10:44
  • check the first answer in this [link](http://stackoverflow.com/questions/27406303/opencv-in-android-studio) – ha_ell Sep 30 '16 at 16:44

1 Answers1

4

Do this

create a jniLibs folder under your main folder(same location as your java folder)

just copy the corresponding OpenCV native libs(there should be seven folders, mips, x86 etc..copy the ones you need, depends on what cpu your app will be running on) from /sdk/native/libs/ to your project directory to folder jniLibs

then in your activity

@Override
public void onResume() {
    super.onResume();
    if (!OpenCVLoader.initDebug()) {
        Logger.d("Internal OpenCV library not found. Using OpenCV Manager for initialization");
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_1_0, this, mLoaderCallback);
    } else {
        Logger.d("OpenCV library found inside package. Using it!");
        mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
    }
}

private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        switch (status) {
            case LoaderCallbackInterface.SUCCESS:
            {
                Logger.d( "OpenCV loaded successfully");
                //mOpenCvCameraView.enableView();
            } break;
            default:
            {
                super.onManagerConnected(status);
            } break;
        }
    }
};
Jeffrey Liu
  • 1,063
  • 1
  • 9
  • 18