I want to create an Android app which uses BOW + SVM in native (using C++) for predicting. Unfortunately I have problem with building the native part. Since the non-free mod
May I add that, in order to use the new libraries in the running application, there are the following steps to do:
1) in your folder libnonfree/libs/[TARGET PLATFORM]/, there are now 3 files: - libgnustl_shared.so - libnonfree.so - libopencv_java.so
in your own project (my IDE is the Android Studio), you have a folder src/main/, with the subfolders: - java - res
create a new folder (if not already there): "jniLibs" [this folder is auto-parsed by Gradle]
COPY the 3 above-mentioned folders under "libnonfree/libs/" into the "jniLibs" folder. you end up with a structure like that: screenshot of the jniLibs folder
/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 app to dynamically load the pre-compiled library from the locally-installed OpenCV Manager. In order to use the self-compiled non-free version, we replace the above line with the following:
if(!OpenCVLoader.initDebug())
{
}
else
{
System.loadLibrary("nonfree");
}
now, we made sure to use the nonfree-included libraries we provide with the app.
3) well, run a 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);
while before, the app would return with a bad signal, this time it does its job and you can evaluate the resulting keypoints.