Example usage for org.opencv.android OpenCVLoader initDebug

List of usage examples for org.opencv.android OpenCVLoader initDebug

Introduction

In this page you can find the example usage for org.opencv.android OpenCVLoader initDebug.

Prototype

public static boolean initDebug() 

Source Link

Document

Loads and initializes OpenCV library from current application package.

Usage

From source file:android.google.com.basiccamera.UIActivity.java

License:BSD License

protected void onFinishedSurfaceChanged() {
    if (INIT_OPENCV) {
        // Load OpenCV
        if (!OpenCVLoader.initDebug()) {
            Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
            OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
        } else {/* ww  w  .j ava2 s .c  om*/
            Log.d(TAG, "OpenCV library found inside package. Using it!");
            mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
        }
    }
}

From source file:cn.xiongyihui.webcam.ForegroundActivity.java

License:Open Source License

@Override
public void onResume() {
    super.onResume();

    Log.v(TAG, "onResume()");

    if (!OpenCVLoader.initDebug()) {
        Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_10, this, mLoaderCallback);
    } else {/*  ww  w  . ja va2 s.  c  o m*/
        Log.d(TAG, "OpenCV library found inside package. Using it!");
        mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
    }

}

From source file:cn.xiongyihui.webcam.MainActivity.java

License:Open Source License

@Override
public void onResume() {
    super.onResume();

    Log.v(TAG, "onResume()");

    if (!OpenCVLoader.initDebug()) {
        Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_10, this, mLoaderCallback);
    } else {/*from  w  w  w.  ja v  a2 s.co m*/
        Log.d(TAG, "OpenCV library found inside package. Using it!");
        mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
    }

    mIsServiceRunning = isServiceRunning();
    updateButton(mIsServiceRunning);
}

From source file:com.android.cts.verifier.sensors.helpers.OpenCVLibrary.java

License:Apache License

/**
 * Load OpenCV Library in async mode/*from  w  w w.j ava 2  s .  c om*/
 *
 * @param context Activity context.
 * @param allowStatic Allow trying load from local package.
 * @param allowInstall Allow installing package from play store.
 *
 * @return if load succeed return true. Return false otherwise.
 */
public static boolean load(Context context, boolean allowLocal, boolean allowPackage, boolean allowInstall) {
    // only need to load once
    if (!sLoaded) {
        // Try static load first
        if (allowLocal && OpenCVLoader.initDebug()) {
            sLoaded = true;
        } else if (allowPackage) {
            if (allowInstall || probePackage(context)) {
                final CountDownLatch done = new CountDownLatch(1);
                // Load the library through async loader
                OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, context,
                        new BaseLoaderCallback(context) {
                            @Override
                            public void onManagerConnected(int status) {
                                Log.v(TAG, "New Loading status: " + status);
                                switch (status) {
                                case LoaderCallbackInterface.SUCCESS: {
                                    sLoaded = true;
                                }
                                    break;
                                default: {
                                    Log.e(TAG, "Connecting OpenCV Manager failed");
                                }
                                    break;
                                }
                                done.countDown();
                            }
                        });
                try {
                    if (!done.await(ASYNC_LOAD_TIMEOUT_SEC, TimeUnit.SECONDS)) {
                        Log.e(TAG, "Time out when attempt async load");
                    }
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            }
        }
    }
    return sLoaded;
}

From source file:com.example.android.camera2basic.CameraActivity.java

License:Apache License

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_camera);
    if (null == savedInstanceState) {
        getFragmentManager().beginTransaction().replace(R.id.container, Camera2BasicFragment.newInstance())
                .commit();//from  w  w  w  .  j av  a 2  s.c o m
    }
    if (!OpenCVLoader.initDebug()) {
        // Handle initialization error
    }
}

From source file:com.example.sarthuak.opencv.MainActivity.java

@Override
public void onResume() {
    super.onResume();
    if (!OpenCVLoader.initDebug()) {
        Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
        //OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
    } else {/*from   w  w w  .  j  a  v a2  s. c  o m*/
        Log.d(TAG, "OpenCV library found inside package. Using it!");
        mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
    }
}

From source file:com.github.mbillingr.correlationcheck.ImageProcessor.java

License:Open Source License

private ImageProcessor() {
    OpenCVLoader.initDebug();

    storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
    mImageFile = new File(storageDir, "scatter.jpg");
}

From source file:com.louislepper.waveform.CameraActivity.java

License:Apache License

@Override
public void onResume() {
    super.onResume();
    if (!OpenCVLoader.initDebug()) {
        Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
    } else {// w w w. j  ava 2 s . c o m
        Log.d(TAG, "OpenCV library found inside package. Using it!");
        mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
    }
}

From source file:com.minio.io.alice.MainActivity.java

License:Open Source License

@Override
public void onResume() {

    super.onResume();

    if (webSocket == null) {
        webSocket = new ClientWebSocket();
        webSocket.connect(context);//from   www  . j  a v a 2s.  co m
    }
    if (!OpenCVLoader.initDebug()) {
        if (XDebug.LOG)
            Log.d(MainActivity.TAG,
                    "Internal OpenCV library not found. Using OpenCV Manager for initialization");
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
    } else {
        if (XDebug.LOG)
            Log.d(MainActivity.TAG, "OpenCV library found inside package. Using it!");
        mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
    }

}

From source file:com.projectcs2103t.openglestest.OpenGLES20Activity.java

License:Apache License

@Override
protected void onResume() {
    super.onResume();
    if (!OpenCVLoader.initDebug()) {
        Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
    } else {/*from   w w w  .j  a  va2 s .  c  o  m*/
        Log.d(TAG, "OpenCV library found inside package. Using it!");
        mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
    }
    // The following call resumes a paused rendering thread.
    // If you de-allocated graphic objects for onPause()
    // this is a good place to re-allocate them.
    mGLView.onResume();
}