Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I have solved the problem.

As I thought, the problem was that, despite I compiled well the modified OpenCV4Android library, I was loading the library dinamically, these changes were not applied, then I was using the library that comes with OpenCV manager (for android).

The solution make the load static, this is, copy ${OpenCV4Android_folder}\OpenCV Library - 3.0.0-dev\lib\<target_arch> to ${proyect_folder}\libs.

Then make the library loading statically. Here an example:

private BaseLoaderCallback mOpenCVCallBack;

[...]

mOpenCVCallBack = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        switch (status) {
        case LoaderCallbackInterface.SUCCESS:
            //Hacer cosas si se ha cargado bien?
            break;
        default:
            super.onManagerConnected(status);
            break;
        }
    }
};

if (!OpenCVLoader.initDebug()){
    //Handle error 
}else{
    mOpenCVCallBack.onManagerConnected(LoaderCallbackInterface.SUCCESS); 
}

NOTE: This solutions is only valid for proyects that not use JNI, otherwise you must follow this tutorial: http://docs.opencv.org/trunk/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html

I have solved the problem.

As I thought, the problem was that, despite I compiled well the modified OpenCV4Android library, I was loading the library dinamically, these changes were not applied, then I was using the library that comes with OpenCV manager (for android).

The solution make the load static, this is, copy ${OpenCV4Android_folder}\OpenCV Library - 3.0.0-dev\lib\<target_arch>${OpenCV4Android_folder}\lib\<target_arch> to ${proyect_folder}\libs.

Then make the library loading statically. Here an example:

private BaseLoaderCallback mOpenCVCallBack;

[...]

mOpenCVCallBack = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        switch (status) {
        case LoaderCallbackInterface.SUCCESS:
            //Hacer cosas si se ha cargado bien?
            break;
        default:
            super.onManagerConnected(status);
            break;
        }
    }
};

if (!OpenCVLoader.initDebug()){
    //Handle error 
}else{
    mOpenCVCallBack.onManagerConnected(LoaderCallbackInterface.SUCCESS); 
}

NOTE: This solutions is only valid for proyects that not use JNI, otherwise you must follow this tutorial: http://docs.opencv.org/trunk/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html

I have solved the problem.

As I thought, the problem was that, despite I compiled well the modified OpenCV4Android library, I was loading the library dinamically, these changes were not applied, then I was using the library that comes with OpenCV manager (for android).

The solution is make the load to be static, this is, copy ${OpenCV4Android_folder}\lib\<target_arch> to ${proyect_folder}\libs.

Then make the library loading statically. Here an example:

private BaseLoaderCallback mOpenCVCallBack;

[...]

mOpenCVCallBack = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        switch (status) {
        case LoaderCallbackInterface.SUCCESS:
            //Hacer cosas si se ha cargado bien?
            break;
        default:
            super.onManagerConnected(status);
            break;
        }
    }
};

if (!OpenCVLoader.initDebug()){
    //Handle error 
}else{
    mOpenCVCallBack.onManagerConnected(LoaderCallbackInterface.SUCCESS); 
}

NOTE: This solutions is only valid for proyects that not use JNI, otherwise you must follow this tutorial: http://docs.opencv.org/trunk/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html