Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV build options, big difference in speed after android library linking

Hi, Until now I used OpenCV4Android coupled with the opencv manager to experiment with ORB features performance on android devices. Now I need to modify an opencv function (for testing) so I switched to OpenCVLoader.initDebug() interface (instead of OpenCVLoader.initAsync()), by linking "libopencv_java.so" inside android project libs. Everything works fine as expected (currently I've done no changes to opencv source yet).

The only problem regards speed. No matter which options I use to compile opencv from trunk, if I link libopencv_java.so from my opencv build, I get almost half the framerate from my feature detector android program. To be sure it wasn't my fault, I extracted "libopencv_java.so" from apk file inside OpenCV4Android SDK (exactly, I extracted it from OpenCV_2.4.9_Manager_2.18_armv7a-neon.apk which is mainly a zip file) and linked it to my android program (no changes made, only linking with extracted libopencv_java.so). Doing this I get full speed back. It seems that the build options of the openCV manager optimize the code same way..

The question is: which options have been used to build opencv manager? Or better, the libraries used during Manager compilation? Currently, the options used to build OpenCV_2.4.9_Manager_2.18_armv7a-neon.apk? I tried any option available (I think), especially the NEON ones, with no improvement. Also, if I link libopencv_java.so obtained from "OpenCV-2.4.9-android-sdk\sdk\native\libs\armeabi-v7a\" I get the same issue, so this means that opencv manager has been compiled with different options.

As additional note, if I install opencv manager from play store, it says my device uses armeabi-v7a with NEON.

These are the options I tried so far compiling "cmake_android_arm.sh" from latest repository (I'm using Ubuntu):

CMAKE_BUILD_TYPE=Release BUILD_SHARED_LIBS=OFF ENABLE_VFPV3=ON ENABLE_NEON=ON USE_NEON=ON ANDOID_ABI="armeabi-v7a with NEON" ANDROID_TOOLCHAIN_NAME="arm-linux-androideabi-4.6" WITH_TBB=ON BUILD_TBB=ON ANDROID_NATIVE_API_LEVEL=19

I need to know with options have been used to compile the library used in opencv manager. I don't need to recompile the manager, only to recompile libopencv_java.so the same way.

Thanks,

Massimo

P.S. maybe has intel IPP been installed and used inside library building? This is the only thing I didn't try yet...