May I add that in order to use the new libraries in the running application, the following steps must be performed:
1) in your folder libnonfree / libs / [TARGET PLATFORM] /, now there are 3 files: - libgnustl_shared.so - libnonfree.so - libopencv_java.so
in your own project (my IDE is Android Studio), you have the src / main / folder with subfolders: - Java - res
create a new folder (if it does not already exist): "jniLibs" [this folder is automatically analyzed using Gradle]
COPY the 3 above folders under "libnonfree / libs /" to the "jniLibs" folder. you get this structure: jniLibs screenshot
/ app / src / main / jniLibs / [armeabi, armeabi-v7a, ...] / [libgnustl_shared.so, libopencv_java.so, libnonfree.so]
2) Somewhere in your code you have a line like this:
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_10, this, mLoaderCallback);
this line tells your application to dynamically load a precompiled library from a locally installed OpenCV Manager. To use the self-compiled non-free version, we replace the above line as follows:
if(!OpenCVLoader.initDebug()) { } else { System.loadLibrary("nonfree"); }
we took care of using the free libraries that we provide to the application.
3) well, run the SURF descriptor:
Bitmap mPhotograph = BitmapFactory.decodeFile(_image_path); Mat real_image = new Mat(); Utils.bitmapToMat(mPhotograph, real_image); MatOfKeyPoint keypoints_real = new MatOfKeyPoint(); FeatureDetector detector = FeatureDetector.create(FeatureDetector.SURF); detector.detect(real_image, keypoints_real);
before the application returns with a bad signal, this time it will do its job, and you can evaluate the key points received.