Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Async Initialization of OpenCV on Android using OpenCVManager

My understanding on the OpenCV structure for Android is limited to whatever was on the site's content. So far, I know how to check for the OpenCV library on a device. What is currently stumping me is it's initialization.

This is my previous code :

private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        switch (status) {
        case LoaderCallbackInterface.SUCCESS: {
            Log.i(TAG, "OpenCV loaded successfully");
                            compare();
        }
            break;
        default: {
            super.onManagerConnected(status);
        }
            break;
        }
    }
};

Where compare() is a function dealing with OpenCV functions such as keypoint detection, descriptor extraction, etc.

Now if I don't call compare() from within the BaseLoader but from the onCreate() function and use OpenCVLoader.init(<params>) within compare() itself, the app crashes with the Unsatisfied Link Error. Could someone point out the correct method of initialization WITH code, please?

Async Initialization of OpenCV on Android using OpenCVManager

My understanding on the OpenCV structure for Android is limited to whatever was on the site's content. So far, I know how to check for the OpenCV library on a device. What is currently stumping me is it's initialization.

This is my previous code :

private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        switch (status) {
        case LoaderCallbackInterface.SUCCESS: {
            Log.i(TAG, "OpenCV loaded successfully");
                            compare();
        }
            break;
        default: {
            super.onManagerConnected(status);
        }
            break;
        }
    }
};

Where compare() is a function dealing with OpenCV functions such as keypoint detection, descriptor extraction, etc.

Now if I don't call compare() from within the BaseLoader but from the onCreate() function and use OpenCVLoader.init(<params>) within compare() itself, the app crashes with the Unsatisfied Link Error. Could someone point out the correct method of initialization WITH code, please?

The error: 03-27 21:18:20.968: W/dalvikvm(1575): No implementation found for native Lorg/opencv/highgui/Highgui;.imread_1 (Ljava/lang/String;)J