Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCVLoader.initAsync() fails for the first few times

OpenCV 3.3.0 Android 7.1.1 Oneplus 5

I installed OpenCV 3.3.0 Manager arm64-v8a by adb to the phone. The OpenCVLoader.initAsync() operation always fails for the first few times, and succeeds finally.

A "Package not found" dialog shows. I click "NO". Repeat this several times. And then succeeds.

Load code is:

@Override public void onResume() { super.onResume(); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_3_0, this, loaderCallback);

}

logcat output:

09-20 17:49:51.577 17807-17807/cn.deepclue.vins2 I/Vins2Tag: In onCreate() 09-20 17:49:51.583 17807-17807/cn.deepclue.vins2 D/CameraBridge: Attr count: 6 09-20 17:49:51.591 17807-17807/cn.deepclue.vins2 I/Vins2Tag: In onResume() 09-20 17:49:51.591 17807-17807/cn.deepclue.vins2 D/Vins2Tag: Using OpenCV Manager for initialization 09-20 17:49:51.592 17807-17807/cn.deepclue.vins2 D/OpenCVManager/Helper: Request new service installation 09-20 17:49:51.605 17807-22993/cn.deepclue.vins2 D/AppTracker: App Event: start 09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call surfaceChanged event 09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call checkCurrentState

Please give me some clue to solve this issue.

OpenCVLoader.initAsync() fails for the first few times

OpenCV 3.3.0 Android 7.1.1 Oneplus 5

I installed OpenCV 3.3.0 Manager arm64-v8a by adb to the phone. The OpenCVLoader.initAsync() operation always fails for the first few times, and succeeds finally.

A "Package not found" dialog shows. I click "NO". Repeat this several times. And then succeeds.

Load code is:

@Override
public void onResume() {
        super.onResume();
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_3_0, this, loaderCallback);

loaderCallback);

}

}

logcat output:

09-20 17:49:51.577 17807-17807/cn.deepclue.vins2 I/Vins2Tag: In onCreate()
09-20 17:49:51.583 17807-17807/cn.deepclue.vins2 D/CameraBridge: Attr count: 6
09-20 17:49:51.591 17807-17807/cn.deepclue.vins2 I/Vins2Tag: In onResume()
09-20 17:49:51.591 17807-17807/cn.deepclue.vins2 D/Vins2Tag: Using OpenCV Manager for initialization
09-20 17:49:51.592 17807-17807/cn.deepclue.vins2 D/OpenCVManager/Helper: Request new service installation
09-20 17:49:51.605 17807-22993/cn.deepclue.vins2 D/AppTracker: App Event: start
09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call surfaceChanged event
09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call checkCurrentState

checkCurrentState

Please give me some clue to solve this issue.

OpenCVLoader.initAsync() fails for the first few times

OpenCV 3.3.0 Android 7.1.1 Oneplus 5

I installed OpenCV 3.3.0 Manager arm64-v8a by adb to the phone. The OpenCVLoader.initAsync() operation always fails for the first few times, and succeeds finally.

A "Package not found" dialog shows. I click "NO". Repeat this several times. And then succeeds.

Load code is:

@Override
public void onResume() {
        super.onResume();
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_3_0, this, loaderCallback);
 }

logcat output:

09-20 17:49:51.577 17807-17807/cn.deepclue.vins2 I/Vins2Tag: In onCreate()
09-20 17:49:51.583 17807-17807/cn.deepclue.vins2 D/CameraBridge: Attr count: 6
09-20 17:49:51.591 17807-17807/cn.deepclue.vins2 I/Vins2Tag: In onResume()
09-20 17:49:51.591 17807-17807/cn.deepclue.vins2 D/Vins2Tag: Using OpenCV Manager for initialization
09-20 17:49:51.592 17807-17807/cn.deepclue.vins2 D/OpenCVManager/Helper: Request new service installation
09-20 17:49:51.605 17807-22993/cn.deepclue.vins2 D/AppTracker: App Event: start
09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call surfaceChanged event
09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call checkCurrentState

Please give me some clue to solve this issue.

OpenCVLoader.initAsync() fails for the first few times

OpenCV 3.3.0 Android 7.1.1 Oneplus 5

I installed OpenCV 3.3.0 Manager arm64-v8a by adb to the phone. The OpenCVLoader.initAsync() operation always fails for the first few times, and succeeds finally.

A "Package not found" dialog shows. I click "NO". Repeat this several times. And then succeeds.

Load code is:

@Override
public void onResume() {
        super.onResume();
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_3_0, this, loaderCallback);
}

logcat output:

09-20 17:49:51.577 17807-17807/cn.deepclue.vins2 I/Vins2Tag: In onCreate()
09-20 17:49:51.583 17807-17807/cn.deepclue.vins2 D/CameraBridge: Attr count: 6
09-20 17:49:51.591 17807-17807/cn.deepclue.vins2 I/Vins2Tag: In onResume()
09-20 17:49:51.591 17807-17807/cn.deepclue.vins2 D/Vins2Tag: Using OpenCV Manager for initialization
09-20 17:49:51.592 17807-17807/cn.deepclue.vins2 D/OpenCVManager/Helper: Request new service installation
09-20 17:49:51.605 17807-22993/cn.deepclue.vins2 D/AppTracker: App Event: start
09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call surfaceChanged event
09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call checkCurrentState

Please give me some clue to solve this issue.

OpenCVLoader.initAsync() fails for the first few times

OpenCV 3.3.0 Android 7.1.1 Oneplus 5

I installed OpenCV 3.3.0 Manager arm64-v8a by adb to the phone. The OpenCVLoader.initAsync() operation always fails for the first few times, and succeeds finally.

A "Package not found" dialog shows. I click "NO". Repeat this several times. And then succeeds.

Load code is:

@Override
public void onResume() {
        super.onResume();
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_3_0, this, loaderCallback);
}

logcat output:

09-20 17:49:51.577 17807-17807/cn.deepclue.vins2 I/Vins2Tag: In onCreate()
09-20 17:49:51.583 17807-17807/cn.deepclue.vins2 D/CameraBridge: Attr count: 6
09-20 17:49:51.592 17807-17807/cn.deepclue.vins2 D/OpenCVManager/Helper: Request new service installation
09-20 17:49:51.605 17807-22993/cn.deepclue.vins2 D/AppTracker: App Event: start
09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call surfaceChanged event
09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call checkCurrentState

Please give me some clue to solve this issue.

The complete code is:

package cn.deepclue.vins2;

import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.SurfaceView; import android.view.WindowManager; import android.widget.TextView;

import org.opencv.android.BaseLoaderCallback; import org.opencv.android.CameraBridgeViewBase; import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2; import org.opencv.android.LoaderCallbackInterface; import org.opencv.android.OpenCVLoader; import org.opencv.core.Mat;

public class MainActivity extends Activity implements CvCameraViewListener2 { private static final String TAG = "Vins2Tag";

private CameraBridgeViewBase cameraView;

// Used to load the 'native-lib' library on application startup.
static {
    System.loadLibrary("native-lib");
}

private BaseLoaderCallback loaderCallback = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        if (status == LoaderCallbackInterface.SUCCESS) {
            Log.i(TAG, "OpenCV loaded successfully");
            cameraView.enableView();
        } else {
            Log.i(TAG, "OpenCV load failed");
        }

        super.onManagerConnected(status);
    }
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "In onCreate()");

    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_main);

    cameraView = (CameraBridgeViewBase) findViewById(R.id.camera_view);

    cameraView.setVisibility(SurfaceView.VISIBLE);

    cameraView.setCvCameraViewListener(this);
}

@Override
public void onPause() {
    super.onPause();
    if (cameraView != null)
        cameraView.disableView();
}

@Override
public void onResume() {
    Log.i(TAG, "In onResume()");
    super.onResume();
    Log.d(TAG, "Using OpenCV Manager for initialization");
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_3_0, this, loaderCallback);

}

public void onDestroy() {
    super.onDestroy();
    if (cameraView != null)
        cameraView.disableView();
}

public void onCameraViewStarted(int width, int height) {
}

public void onCameraViewStopped() {
}

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
    return inputFrame.rgba();
}

/**
 * A native method that is implemented by the 'native-lib' native library,
 * which is packaged with this application.
 */
public native String stringFromJNI();

}

OpenCVLoader.initAsync() fails for the first few times

OpenCV 3.3.0 Android 7.1.1 Oneplus 5

I installed OpenCV 3.3.0 Manager arm64-v8a by adb to the phone. The OpenCVLoader.initAsync() operation always fails for the first few times, and succeeds finally.

A "Package not found" dialog shows. I click "NO". Repeat this several times. And then succeeds.

Load code is:

@Override
public void onResume() {
        super.onResume();
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_3_0, this, loaderCallback);
}

logcat output:

09-20 17:49:51.577 17807-17807/cn.deepclue.vins2 I/Vins2Tag: In onCreate()
09-20 17:49:51.583 17807-17807/cn.deepclue.vins2 D/CameraBridge: Attr count: 6
09-20 17:49:51.592 17807-17807/cn.deepclue.vins2 D/OpenCVManager/Helper: Request new service installation
09-20 17:49:51.605 17807-22993/cn.deepclue.vins2 D/AppTracker: App Event: start
09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call surfaceChanged event
09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call checkCurrentState

Please give me some clue to solve this issue.

The complete code is:

package cn.deepclue.vins2;

cn.deepclue.vins2;

import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.SurfaceView; import android.view.WindowManager; import android.widget.TextView;

import org.opencv.android.BaseLoaderCallback; import org.opencv.android.CameraBridgeViewBase; import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2; import org.opencv.android.LoaderCallbackInterface; import org.opencv.android.OpenCVLoader; import org.opencv.core.Mat;

public class MainActivity extends Activity implements CvCameraViewListener2 { private static final String TAG = "Vins2Tag";

private CameraBridgeViewBase cameraView;

// Used to load the 'native-lib' library on application startup.
static {
    System.loadLibrary("native-lib");
}

private BaseLoaderCallback loaderCallback = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        if (status == LoaderCallbackInterface.SUCCESS) {
            Log.i(TAG, "OpenCV loaded successfully");
            cameraView.enableView();
        } else {
            Log.i(TAG, "OpenCV load failed");
        }

        super.onManagerConnected(status);
    }
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "In onCreate()");

    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_main);

    cameraView = (CameraBridgeViewBase) findViewById(R.id.camera_view);

    cameraView.setVisibility(SurfaceView.VISIBLE);

    cameraView.setCvCameraViewListener(this);
}

@Override
public void onPause() {
    super.onPause();
    if (cameraView != null)
        cameraView.disableView();
}

@Override
public void onResume() {
    Log.i(TAG, "In onResume()");
    super.onResume();
    Log.d(TAG, "Using OpenCV Manager for initialization");
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_3_0, this, loaderCallback);

}

public void onDestroy() {
    super.onDestroy();
    if (cameraView != null)
        cameraView.disableView();
}

public void onCameraViewStarted(int width, int height) {
}

public void onCameraViewStopped() {
}

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
    return inputFrame.rgba();
}

/**
 * A native method that is implemented by the 'native-lib' native library,
 * which is packaged with this application.
 */
public native String stringFromJNI();

}

OpenCVLoader.initAsync() fails for the first few times

OpenCV 3.3.0 Android 7.1.1 Oneplus 5

I installed OpenCV 3.3.0 Manager arm64-v8a by adb to the phone. The OpenCVLoader.initAsync() operation always fails for the first few times, and succeeds finally.

A "Package not found" dialog shows. I click "NO". Repeat this several times. And then succeeds.

Load code is:

@Override
public void onResume() {
        super.onResume();
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_3_0, this, loaderCallback);
}

logcat output:

09-20 17:49:51.577 17807-17807/cn.deepclue.vins2 I/Vins2Tag: In onCreate()
09-20 17:49:51.583 17807-17807/cn.deepclue.vins2 D/CameraBridge: Attr count: 6
09-20 17:49:51.592 17807-17807/cn.deepclue.vins2 D/OpenCVManager/Helper: Request new service installation
09-20 17:49:51.605 17807-22993/cn.deepclue.vins2 D/AppTracker: App Event: start
09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call surfaceChanged event
09-20 17:49:51.640 17807-17807/cn.deepclue.vins2 D/CameraBridge: call checkCurrentState

Please give me some clue to solve this issue.

The complete code is:

package cn.deepclue.vins2;

import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.SurfaceView; import android.view.WindowManager; import android.widget.TextView;

import org.opencv.android.BaseLoaderCallback; import org.opencv.android.CameraBridgeViewBase; import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2; import org.opencv.android.LoaderCallbackInterface; import org.opencv.android.OpenCVLoader; import org.opencv.core.Mat;

public class MainActivity extends Activity implements CvCameraViewListener2 {
 private static final String TAG = "Vins2Tag";

"Vins2Tag";

private CameraBridgeViewBase cameraView;

// Used to load the 'native-lib' library on application startup.
static {
    System.loadLibrary("native-lib");
}

private BaseLoaderCallback loaderCallback = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        if (status == LoaderCallbackInterface.SUCCESS) {
            Log.i(TAG, "OpenCV loaded successfully");
            cameraView.enableView();
        } else {
            Log.i(TAG, "OpenCV load failed");
        }

        super.onManagerConnected(status);
    }
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "In onCreate()");

    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_main);

    cameraView = (CameraBridgeViewBase) findViewById(R.id.camera_view);

    cameraView.setVisibility(SurfaceView.VISIBLE);

    cameraView.setCvCameraViewListener(this);
}

@Override
public void onPause() {
    super.onPause();
    if (cameraView != null)
        cameraView.disableView();
}

@Override
public void onResume() {
    Log.i(TAG, "In onResume()");
    super.onResume();
    Log.d(TAG, "Using OpenCV Manager for initialization");
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_3_0, this, loaderCallback);

}

public void onDestroy() {
    super.onDestroy();
    if (cameraView != null)
        cameraView.disableView();
}

public void onCameraViewStarted(int width, int height) {
}

public void onCameraViewStopped() {
}

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
    return inputFrame.rgba();
}

/**
 * A native method that is implemented by the 'native-lib' native library,
 * which is packaged with this application.
 */
public native String stringFromJNI();
}

}